From 2813981130d914ed0dc60dd8966c535c601b9877 Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Thu, 15 Feb 2024 13:41:23 +0100 Subject: [PATCH] CMake: Move build options for Shiboken/Pyside to the top --- .../FreeCAD_Helpers/SetupShibokenAndPyside.cmake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake b/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake index aca36bc439..14e896c083 100644 --- a/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake +++ b/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake @@ -1,6 +1,9 @@ macro(SetupShibokenAndPyside) # -------------------------------- Shiboken/PySide ------------------------ + option(FREECAD_USE_SHIBOKEN "Links to the shiboken library at build time. If OFF its Python module is imported at runtime" ON) + option(FREECAD_USE_PYSIDE "Links to the PySide libraries at build time." ON) + if(DEFINED MACPORTS_PREFIX) find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") @@ -113,11 +116,9 @@ macro(SetupShibokenAndPyside) endif() # If shiboken cannot be found the build option will be set to OFF - if(SHIBOKEN_INCLUDE_DIR) - option(FREECAD_USE_SHIBOKEN "Links to the shiboken library at build time. If OFF its Python module is imported at runtime" ON) - else() + if(NOT SHIBOKEN_INCLUDE_DIR) message(WARNING "Shiboken${PYSIDE_MAJOR_VERSION} include files not found, FREECAD_USE_SHIBOKEN automatically set to OFF") - option(FREECAD_USE_SHIBOKEN "Links to the shiboken library at build time. If OFF its Python module is imported at runtime" OFF) + set(FREECAD_USE_SHIBOKEN OFF) endif() # Now try to import the shiboken Python module and print a warning if it can't be loaded @@ -141,11 +142,9 @@ macro(SetupShibokenAndPyside) endif() # If PySide cannot be found the build option will be set to OFF - if(PYSIDE_INCLUDE_DIR) - option(FREECAD_USE_PYSIDE "Links to the PySide libraries at build time." ON) - else() + if(NOT PYSIDE_INCLUDE_DIR) message(WARNING "PySide${PYSIDE_MAJOR_VERSION} include files not found, FREECAD_USE_PYSIDE automatically set to OFF") - option(FREECAD_USE_PYSIDE "Links to the PySide libraries at build time." OFF) + set(FREECAD_USE_PYSIDE OFF) endif() # Independent of the build option PySide modules must be loaded at runtime. Print a warning if it fails.