Sfoglia il codice sorgente

ENH: BuildSystem: Ensure "ENABLE" variable are passed and remove workaround

This commit removes workaround introduced in 6cc426b.

By ensuring variables like CTK_ENABLE_Widget are passed to the inner build
project, there is no need to teach "mark_as_superbuild" to ignore cached value
of variables like CTK_LIB_Widgets.

Since the variable causing the value in the current scope to be different
from the value in the cache is also passed, the logic setting dependent
variables is triggered again.
Jean-Christophe Fillion-Robin 7 anni fa
parent
commit
9c8bf39595

+ 3 - 10
CMake/ctkMacroCheckExternalProjectDependency.cmake

@@ -202,16 +202,9 @@ function(_sb_cmakevar_to_cmakearg cmake_varname_and_type cmake_arg_var has_cfg_i
   _sb_extract_varname_and_vartype(${cmake_varname_and_type} _varname _vartype)
 
   set(_var_value "${${_varname}}")
-
-  set(_consider_cache_value 1)
-  if(DEFINED ${_varname}_SKIPCACHEVALUE AND ${_varname}_SKIPCACHEVALUE)
-    set(_consider_cache_value 0)
-  endif()
-  if(_consider_cache_value)
-    get_property(_value_set_in_cache CACHE ${_varname} PROPERTY VALUE SET)
-    if(_value_set_in_cache)
-      get_property(_var_value CACHE ${_varname} PROPERTY VALUE)
-    endif()
+  get_property(_value_set_in_cache CACHE ${_varname} PROPERTY VALUE SET)
+  if(_value_set_in_cache)
+    get_property(_var_value CACHE ${_varname} PROPERTY VALUE)
   endif()
 
   set(_has_cfg_intdir FALSE)

+ 1 - 1
CMake/ctkMacroOptionUtils.cmake

@@ -30,7 +30,6 @@ macro(ctk_option option_prefix name doc default)
       message(STATUS "Enabling [${option_prefix}_${name}] because of [${enabling_msg}] evaluates to True")
     endif()
   endif()
-  set(${option_prefix}_${name}_SKIPCACHEVALUE 1)
   mark_as_superbuild(${option_prefix}_${name})
 endmacro()
 
@@ -60,6 +59,7 @@ endmacro()
 
 macro(ctk_enable_option_raw name doc default)
   option(${name} "${doc}" ${default})
+  mark_as_superbuild(${name})
   if(DEFINED ${name}_internal)
     if(${${name}} AND ${${name}_internal})
       if(NOT (${ARGN}))

+ 1 - 1
CMake/ctkMacroSetupQt.cmake

@@ -34,7 +34,7 @@ macro(ctkMacroSetupQt)
     cmake_minimum_required(VERSION 2.8.12)
     find_package(Qt5 COMPONENTS Core)
     set(CTK_QT5_COMPONENTS Core Xml XmlPatterns Concurrent Sql Test)
-    if(CTK_LIB_Widgets OR CTK_LIB_CommandLineModules/Frontend/QtGui OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES)
+    if(CTK_ENABLE_Widgets OR CTK_LIB_Widgets OR CTK_LIB_CommandLineModules/Frontend/QtGui OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES)
       list(APPEND CTK_QT5_COMPONENTS Widgets OpenGL UiTools)
     endif()
     if(CTK_LIB_CommandLineModules/Frontend/QtWebKit OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES)