瀏覽代碼

Merge branch 'superbuild_features' into ctkSimplePythonShell

* superbuild_features:
  ENH: Superbuild - Simplify the way boolean option are passed to CTK inner build
  ENH: Superbuild - CTK library option are now passed to CTK inner build
  ENH: Superbuild - Underscore are now valid character in CTK library option name
  ENH: Superbuild - Ctk library options are now marked as advanced
Jean-Christophe Fillion-Robin 15 年之前
父節點
當前提交
693e06246b
共有 4 個文件被更改,包括 6 次插入13 次删除
  1. 1 1
      CMake/ctkFunctionExtractOptionNameAndValue.cmake
  2. 2 0
      CMake/ctkMacroAddCtkLibraryOptions.cmake
  3. 1 0
      CMakeLists.txt
  4. 2 12
      SuperBuild.cmake

+ 1 - 1
CMake/ctkFunctionExtractOptionNameAndValue.cmake

@@ -6,7 +6,7 @@
 FUNCTION(ctkFunctionExtractOptionNameAndValue my_opt var_opt_name var_opt_value)
 
  # Make sure option is correctly formated
-  IF(NOT "${my_opt}" MATCHES "^[/A-Za-z0-9.]+:(ON|OFF)")
+  IF(NOT "${my_opt}" MATCHES "^[/A-Za-z0-9._]+:(ON|OFF)")
     MESSAGE(FATAL_ERROR "Option ${my_opt} is incorrect. Options should be specified using the following format OPT1:[ON|OFF]. For example OPT1:OFF or OPT2:ON")
   ENDIF()
 

+ 2 - 0
CMake/ctkMacroAddCtkLibraryOptions.cmake

@@ -37,6 +37,8 @@ MACRO(ctkMacroAddCtkLibraryOptions lib)
     FOREACH(option ${ctk_library_options})
       ctkFunctionExtractOptionNameAndValue(${option} option_name option_value)
       OPTION(CTK_LIB_${lib}_${option_name} "Enable ${lib} Library ${option_name} option." ${option_value})
+      MARK_AS_ADVANCED(CTK_LIB_${lib}_${option_name})
+      LIST(APPEND ctk_lib_options_list CTK_LIB_${lib}_${option_name})
     ENDFOREACH()
     
   ENDIF()

+ 1 - 0
CMakeLists.txt

@@ -331,6 +331,7 @@ SET(CTK_APPLICATIONS_SUBDIRS )
 #  CTK_LIB_<DIR>/<LIBNAME>_OPT1  (set to OFF)
 #  CTK_LIB_<DIR>/<LIBNAME>_OPT2  (set to ON)
 #
+SET(ctk_lib_options_list) # This list will be updated in ctkFunctionExtractOptionNameAndValue
 FOREACH(lib ${CTK_LIBS})
   ctkFunctionExtractOptionNameAndValue(${lib} lib_name lib_value)
   OPTION(CTK_LIB_${lib_name} "Enable ${lib_name} Library." ${lib_value})

+ 2 - 12
SuperBuild.cmake

@@ -170,16 +170,6 @@ FOREACH(app ${CTK_APPLICATIONS_SUBDIRS})
 ENDFOREACH()
 
 #-----------------------------------------------------------------------------
-# Convenient function allowing to define superbuild arg
-#
-FUNCTION(ctk_set_superbuild_boolean_arg ctk_cmake_var)
-  SET(superbuild_${ctk_cmake_var} OFF)
-  IF(DEFINED ${ctk_cmake_var})
-    SET(superbuild_${ctk_cmake_var} ${${ctk_cmake_var}} PARENT_SCOPE)
-  ENDIF()
-ENDFUNCTION()
-
-#-----------------------------------------------------------------------------
 # Set superbuild boolean args
 #
 
@@ -192,12 +182,12 @@ SET(ctk_cmake_boolean_args
   ${ctk_libs_bool_vars}
   ${ctk_plugins_bool_vars}
   ${ctk_applications_bool_vars}
+  ${ctk_lib_options_list}
   )
 
 SET(ctk_superbuild_boolean_args)
 FOREACH(ctk_cmake_arg ${ctk_cmake_boolean_args})
-  ctk_set_superbuild_boolean_arg(${ctk_cmake_arg})
-  LIST(APPEND ctk_superbuild_boolean_args -D${ctk_cmake_arg}:BOOL=${superbuild_${ctk_cmake_arg}})
+  LIST(APPEND ctk_superbuild_boolean_args -D${ctk_cmake_arg}:BOOL=${${ctk_cmake_arg}})
 ENDFOREACH()
 
 # MESSAGE("CMake args:")