Преглед на файлове

Merge branch 'REBASE-258-fix-highlevel-cmake-options'

* REBASE-258-fix-highlevel-cmake-options:
  Fix dependency of Scripting/Python/{Core, Widgets} options
  Print message if CTK_{APP, LIB, PLUGIN} options set to ON because of BUILD_ALL options
  Ensure CTK_ENABLE_Python_Wrapping remain set when CTK_BUILD_ALL is ON
Jean-Christophe Fillion-Robin преди 11 години
родител
ревизия
5ebab0778c
променени са 2 файла, в които са добавени 56 реда и са изтрити 56 реда
  1. 5 5
      CMake/ctkMacroOptionUtils.cmake
  2. 51 51
      CMakeLists.txt

+ 5 - 5
CMake/ctkMacroOptionUtils.cmake

@@ -23,11 +23,8 @@ macro(ctk_option option_prefix name doc default)
   set(_logical_expr ${ARGN})
   if(_logical_expr AND NOT ${option_prefix}_${name})
     if(${ARGN})
-      # Force the option to ON. This is okay since the
-      # logical expression should contain a CTK_ENABLE_*
-      # option value, which requires the current option to be ON.
-      get_property(_doc_string CACHE ${option_prefix}_${name} PROPERTY HELPSTRING)
-      set(${option_prefix}_${name} ON CACHE BOOL ${_doc_string} FORCE)
+      # Set the variable ON.
+      set(${option_prefix}_${name} ON)
       # Generate user-friendly message
       set(enabling_msg)
       ctk_option_logical_expression_to_message(enabling_msg "${ARGN}")
@@ -40,6 +37,7 @@ macro(ctk_lib_option name doc default)
   ctk_option(CTK_LIB ${name} ${doc} ${default} ${ARGN})
   if(CTK_BUILD_ALL_LIBRARIES)
     set(CTK_LIB_${name} 1)
+    message(STATUS "Enabling [CTK_LIB_${name}] because of [CTK_BUILD_ALL_LIBRARIES:${CTK_BUILD_ALL_LIBRARIES}] evaluates to True")
   endif()
 endmacro()
 
@@ -47,6 +45,7 @@ macro(ctk_plugin_option name doc default)
   ctk_option(CTK_PLUGIN ${name} ${doc} ${default} ${ARGN})
   if(CTK_BUILD_ALL_PLUGINS)
     set(CTK_PLUGIN_${name} 1)
+    message(STATUS "Enabling [CTK_PLUGIN_${name}] because of [CTK_BUILD_ALL_PLUGINS:${CTK_BUILD_ALL_PLUGINS}] evaluates to True")
   endif()
 endmacro()
 
@@ -54,6 +53,7 @@ macro(ctk_app_option name doc default)
   ctk_option(CTK_APP ${name} ${doc} ${default} ${ARGN})
   if(CTK_BUILD_ALL_APPS)
     set(CTK_APP_${name} 1)
+    message(STATUS "Enabling [CTK_APP_${name}] because of [CTK_BUILD_ALL_APPS:${CTK_BUILD_ALL_APPS}] evaluates to True")
   endif()
 endmacro()
 

+ 51 - 51
CMakeLists.txt

@@ -407,35 +407,6 @@ endif()
 #
 
 #-----------------------------------------------------------------------------
-# High-Level CTK options
-
-# The ctk_enable_option macro expects a logical expression after the first
-# three arguments. This expression should only contain build option names
-# which belong to leafs in the required dependency tree.
-
-# The CTK infrastructure for high-level DICOM support. This includes
-# DICOM indexing, networking, and GUI widgets.
-ctk_enable_option(DICOM "Enable default DICOM support" OFF
-                  CTK_LIB_DICOM/Widgets)
-
-# The CTK infrastructure for building a DICOM Part 19 compliant application
-# host and/or hosted application. This will not enable any example plugins
-# or executables (enable CTK_ENABLE_EXAMPLES for that).
-ctk_enable_option(DICOMApplicationHosting "Enable DICOM Part 19 Application Hosting support" OFF
-                  CTK_PLUGIN_org.commontk.dah.host AND CTK_PLUGIN_org.commontk.dah.hostedapp)
-
-# The CTK Qt Widgets. This will enable the Qt Widget library only.
-# It might trigger the enabling of other widget libraries in combination
-# with other enabled options.
-ctk_enable_option(Widgets "Enable Qt Widget libraries" OFF
-                  CTK_LIB_Widgets)
-
-# The CTK Plugin Framework, a dynamic component system based on OSGi.
-# This will enable only the framework itself.
-ctk_enable_option(PluginFramework "Enable Plugin Framework" OFF
-                  CTK_LIB_PluginFramework)
-
-#-----------------------------------------------------------------------------
 # Special "BUILD ALL" options
 
 # Build all CTK plug-ins
@@ -462,25 +433,6 @@ endif()
 #-----------------------------------------------------------------------------
 # Other options
 
-# The CTK Python Wrapping
-ctk_enable_option(Python_Wrapping "Wrap CTK classes using Qt meta-object system into Python language" OFF
-                  CTK_LIB_Scripting/Python/Core)
-mark_as_superbuild(CTK_ENABLE_Python_Wrapping)
-
-# Build examples
-# Create the logical expression containing the minium set of required options
-# for the CTK_BUILD_EXAMPLES option to be ON
-set(_build_examples_logical_expr)
-foreach(_app ${CTK_ENABLED_APPS})
-  list(APPEND _build_examples_logical_expr CTK_APP_${_app} AND)
-endforeach()
-if(_build_examples_logical_expr)
-  list(REMOVE_AT _build_examples_logical_expr -1)
-endif()
-
-ctk_enable_option_raw(CTK_BUILD_EXAMPLES "Build examples for CTK components" OFF
-                  ${_build_examples_logical_expr})
-
 # Git protocol option
 option(CTK_USE_GIT_PROTOCOL "If behind a firewall turn this OFF to use http instead." ON)
 mark_as_advanced(CTK_USE_GIT_PROTOCOL)
@@ -530,11 +482,11 @@ ctk_lib_option(ImageProcessing/ITK/Core
                "Build the ITK Core library" OFF)
 
 ctk_lib_option(Scripting/Python/Core
-               "Build the Python Core library" OFF)
+               "Build the Python Core library" OFF
+               CTK_ENABLE_Python_Wrapping)
 
 ctk_lib_option(Scripting/Python/Widgets
-               "Build the Python Widgets library" OFF
-               CTK_LIB_Widgets AND CTK_ENABLE_Python_Wrapping)
+               "Build the Python Widgets library" OFF)
 
 ctk_lib_option(Visualization/VTK/Core
                "Build the VTK Core library" OFF)
@@ -741,6 +693,54 @@ if(CTK_USE_CONTRIBUTED_PLUGINS)
 endif()
 
 #-----------------------------------------------------------------------------
+# High-Level CTK options
+
+# The ctk_enable_option macro expects a logical expression after the first
+# three arguments. This expression should only contain build option names
+# which belong to leafs in the required dependency tree.
+
+# The CTK infrastructure for high-level DICOM support. This includes
+# DICOM indexing, networking, and GUI widgets.
+ctk_enable_option(DICOM "Enable default DICOM support" OFF
+                  CTK_LIB_DICOM/Widgets)
+
+# The CTK infrastructure for building a DICOM Part 19 compliant application
+# host and/or hosted application. This will not enable any example plugins
+# or executables (enable CTK_ENABLE_EXAMPLES for that).
+ctk_enable_option(DICOMApplicationHosting "Enable DICOM Part 19 Application Hosting support" OFF
+                  CTK_PLUGIN_org.commontk.dah.host AND CTK_PLUGIN_org.commontk.dah.app)
+
+# The CTK Qt Widgets. This will enable the Qt Widget library only.
+# It might trigger the enabling of other widget libraries in combination
+# with other enabled options.
+ctk_enable_option(Widgets "Enable Qt Widget libraries" OFF
+                  CTK_LIB_Widgets)
+
+# The CTK Plugin Framework, a dynamic component system based on OSGi.
+# This will enable only the framework itself.
+ctk_enable_option(PluginFramework "Enable Plugin Framework" OFF
+                  CTK_LIB_PluginFramework)
+
+# The CTK Python Wrapping
+ctk_enable_option(Python_Wrapping "Wrap CTK classes using Qt meta-object system into Python language" OFF
+                  CTK_LIB_Scripting/Python/Core)
+mark_as_superbuild(CTK_ENABLE_Python_Wrapping)
+
+# Build examples
+# Create the logical expression containing the minium set of required options
+# for the CTK_BUILD_EXAMPLES option to be ON
+set(_build_examples_logical_expr)
+foreach(_app ${CTK_ENABLED_APPS})
+  list(APPEND _build_examples_logical_expr CTK_APP_${_app} AND)
+endforeach()
+if(_build_examples_logical_expr)
+  list(REMOVE_AT _build_examples_logical_expr -1)
+endif()
+
+ctk_enable_option_raw(CTK_BUILD_EXAMPLES "Build examples for CTK components" OFF
+                  ${_build_examples_logical_expr})
+
+#-----------------------------------------------------------------------------
 # Generate target_directories list - List of directory corresponding to the different
 # libraries, plugins and applications associated with the corresponding option name.
 #