Bläddra i källkod

Ensure ctk option are considered as superbuild candidate variable.

This fix issue introduced following commit dc70d03 and extend
the functionality of the external project dependency module by
introducing the "_SKIPCACHEVALUE" option.

By setting the variable <varname>_SKIPCACHEVALUE, the system
won't consider the cached value of an option. This is currently needed
in CTK because enabling top level option set the variable in the
current scope without setting the variable in the cache. For that
matter, the value in the current scope should be considered.

Note that the upstream project [1] hosting the external project dependency
macro hasn't yet been updated to support the skip cache value variable.

[1] https://github.com/commontk/Artichoke
Jean-Christophe Fillion-Robin 11 år sedan
förälder
incheckning
6cc426bbfb
2 ändrade filer med 12 tillägg och 4 borttagningar
  1. 10 3
      CMake/ctkMacroCheckExternalProjectDependency.cmake
  2. 2 1
      CMake/ctkMacroOptionUtils.cmake

+ 10 - 3
CMake/ctkMacroCheckExternalProjectDependency.cmake

@@ -182,9 +182,16 @@ 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}}")
-  get_property(_value_set_in_cache CACHE ${_varname} PROPERTY VALUE SET)
-  if(_value_set_in_cache)
-    get_property(_var_value CACHE ${_varname} PROPERTY VALUE)
+
+  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()
   endif()
 
   set(_has_cfg_intdir FALSE)

+ 2 - 1
CMake/ctkMacroOptionUtils.cmake

@@ -18,7 +18,6 @@ endfunction()
 macro(ctk_option option_prefix name doc default)
   option(${option_prefix}_${name} ${doc} ${default})
   mark_as_advanced(${option_prefix}_${name})
-  mark_as_superbuild(${option_prefix}_${name})
   list(APPEND ${option_prefix}S ${name})
   set(_logical_expr ${ARGN})
   if(_logical_expr AND NOT ${option_prefix}_${name})
@@ -31,6 +30,8 @@ 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()
 
 macro(ctk_lib_option name doc default)