Quellcode durchsuchen

ENH: Update ctkMacroGenerateDGraphInput to present a thrid parameter 'with_option'

If with_option is TRUE, the file DGraphInput.txt will be generated, this later
one consider only the enabled dependencies.

If with_option is FALSE, the file DGraphInput-alldep.txt will be generated,
this later one include all dependencies (whatever is the value of the corresponding
option)
Jean-Christophe Fillion-Robin vor 15 Jahren
Ursprung
Commit
d274854a98
1 geänderte Dateien mit 16 neuen und 8 gelöschten Zeilen
  1. 16 8
      CMake/ctkMacroGenerateDGraphInput.cmake

+ 16 - 8
CMake/ctkMacroGenerateDGraphInput.cmake

@@ -1,8 +1,8 @@
 
 #
+# Generate a DGrapgh input file expected by DGraph executable.
 #
-#
-MACRO(ctkMacroGenerateDGraphInput dir name target_directories)
+MACRO(ctkMacroGenerateDGraphInput dir target_directories with_option)
   IF(NOT EXISTS ${dir})
     MESSAGE(FATAL_ERROR "Directory ${dir} doesn't exist!")
   ENDIF()
@@ -21,13 +21,17 @@ MACRO(ctkMacroGenerateDGraphInput dir name target_directories)
     LIST(GET target_info_list 1 option_name)
     #MESSAGE(STATUS target_dir:${target_dir})
     #MESSAGE(STATUS option_name:${option_name})
+    #MESSAGE(STATUS option_name-value:${${option_name}})
     
     # make sure the directory exists
     IF(NOT EXISTS ${target_dir}/CMakeLists.txt)
       MESSAGE(FATAL_ERROR "Target directory ${target_dir}/CMakeLists.txt doesn't exists !")
     ENDIF()
 
+    SET(include_dep 1)
+    IF(${with_option})
       SET(include_dep ${${option_name}})
+    ENDIF()
     IF(${include_dep})
       # extract project name from CMakeLists.txt
       FILE(STRINGS "${target_dir}/CMakeLists.txt" project_string
@@ -39,7 +43,7 @@ MACRO(ctkMacroGenerateDGraphInput dir name target_directories)
         MESSAGE(FATAL_ERROR "Failed to extract project name from ${target_dir}/CMakeLists.txt")
       ENDIF()
       #MESSAGE(STATUS target_project_name:${target_project_name})
-      
+
       LIST(APPEND vertices ${target_project_name})
 
       # Make sure the variable is cleared
@@ -47,13 +51,13 @@ MACRO(ctkMacroGenerateDGraphInput dir name target_directories)
 
       # get dependencies
       ctkMacroCollectTargetLibraryNames(${target_dir} dependencies)
-      
+
       # Make sure the variable is cleared
       SET(ctk_dependencies)
 
       # filter dependencies starting with CTK
       ctkMacroGetAllCTKTargetLibraries("${dependencies}" ctk_dependencies)
-      
+
       # Generate XML related to the dependencies
       FOREACH(dependency_name ${ctk_dependencies})
         LIST(APPEND edges ${dependency_name})
@@ -68,9 +72,13 @@ MACRO(ctkMacroGenerateDGraphInput dir name target_directories)
   LIST(LENGTH edges numberOfEdges)
 
   SET(dgraph_list "${numberOfVertices} ${numberOfEdges}\n" ${dgraph_list})
-  
-  SET(filename "${dir}/DGraphInput.txt")
+
+  IF(${with_option})
+    SET(filename "${dir}/DGraphInput.txt")
+  ELSE()
+    SET(filename "${dir}/DGraphInput-alldep.txt")
+  ENDIF()
 
   FILE(WRITE ${filename} ${dgraph_list})
   MESSAGE(STATUS "Generated: ${filename}")
-ENDMACRO()
+ENDMACRO()