From 6c2815214a1010a64c06fb7dfad7a9cb09182bb5 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 10 Jun 2020 10:18:47 +0200 Subject: [PATCH] CMake: [skip ci] add build option to let the user decide to link with shiboken/PySide at build time --- cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake | 7 +++++++ src/Gui/CMakeLists.txt | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake b/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake index 18a8d01d70..8d64704380 100644 --- a/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake +++ b/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake @@ -136,4 +136,11 @@ macro(SetupShibokenAndPyside) find_package(PySideTools REQUIRED) # PySide utilities (pyside-uic & pyside-rcc) endif(BUILD_QT5) + # If shiboken cannot be found the build option will be set to OFF + if(NOT SHIBOKEN_INCLUDE_DIR) + option(FREECAD_USE_SHIBOKEN "Links to the shiboken and PySide libraries at build time. If OFF their Python modules are imported at runtime" OFF) + else() + option(FREECAD_USE_SHIBOKEN "Links to the shiboken and PySide libraries at build time. If OFF their Python modules are imported at runtime" ON) + endif(NOT SHIBOKEN_INCLUDE_DIR) + endmacro(SetupShibokenAndPyside) diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 287a38ddac..96c05a7234 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -171,7 +171,7 @@ IF(OCULUS_FOUND) ) ENDIF(OCULUS_FOUND) -if(SHIBOKEN_INCLUDE_DIR) +if(FREECAD_USE_SHIBOKEN) if (BUILD_QT5) add_definitions(-DHAVE_SHIBOKEN2) else() @@ -191,7 +191,7 @@ if(SHIBOKEN_INCLUDE_DIR) ) endif (TARGET Shiboken2::libshiboken) endif (SHIBOKEN_LIBRARY) -endif(SHIBOKEN_INCLUDE_DIR) +endif(FREECAD_USE_SHIBOKEN) if(PYSIDE_INCLUDE_DIR) include_directories(