Salome HOME
CMake: new macro SALOME_CONFIGURE_PREPARE() to build the list of required variables
authorbruneton <bruneton>
Mon, 28 Oct 2013 14:42:29 +0000 (14:42 +0000)
committerbruneton <bruneton>
Mon, 28 Oct 2013 14:42:29 +0000 (14:42 +0000)
that will be expanded when configuring Salome<MODULE>Config.cmake

salome_adm/cmake_files/FindSalomeVTK.cmake
salome_adm/cmake_files/SalomeMacros.cmake

index b2fa8d12b4505c4344f5ca2d444fd55f66c08934..452ac9b4f981b38d83d1865ed651f7f722cbe178 100644 (file)
@@ -25,9 +25,7 @@
 #
 
 # List the required components:
-#   Seting the following variable is equivalent to having passed the components
-#   when calling the FIND_PACKAGE() command.
-SET(SalomeVTK_FIND_COMPONENTS 
+SET(SalomeVTK_COMPONENTS 
   vtkRenderingFreeTypeOpenGL
   vtkRenderingLOD 
   vtkRenderingAnnotation 
@@ -39,6 +37,10 @@ SET(SalomeVTK_FIND_COMPONENTS
   vtkFiltersVerdict
 )
 
+#   Seting the following variable is equivalent to having passed the components
+#   when calling the FIND_PACKAGE() command.
+SET(SalomeVTK_FIND_COMPONENTS ${SalomeVTK_COMPONENTS})
+
 # If no VTK root dir is specified, try the ParaView root dir:
 SET(PARAVIEW_ROOT_DIR "$ENV{PARAVIEW_ROOT_DIR}" CACHE PATH "Path to the ParaView installation")
 IF(EXISTS "${PARAVIEW_ROOT_DIR}" AND (NOT VTK_ROOT_DIR))
index ef8d8a3f1a14a960f1d89a3845e5ab8fc3ca652e..75c291ffdbe66f3365524cf5134e4a575af1e991 100755 (executable)
@@ -673,3 +673,53 @@ MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar val)
   ENDFOREACH()
 ENDMACRO(SALOME_ACCUMULATE_ENVIRONMENT)
 
+
+#########################################################################
+# SALOME_APPEND_LIST_OF_LIST()
+# 
+# USAGE: SALOME_APPEND_LIST_OF_LIST(result element_list)
+#
+# Build a list of lists. The element_list is first parsed to convert it 
+# from 
+#     a;b;c;d;e
+# to 
+#     a,b,c,d,e
+#
+# It is then added to the big list 'result'. Hence 'result' looks like:
+#     a,b,c,d,e;f,g,h; ...
+#
+MACRO(SALOME_APPEND_LIST_OF_LIST result element_list)
+  SET(_tmp_res)
+  STRING(REPLACE ";" "," _tmp_res "${${element_list}}")
+  LIST(APPEND ${result} ${_tmp_res})
+ENDMACRO(SALOME_APPEND_LIST_OF_LIST)
+
+#########################################################################
+# SALOME_CONFIGURE_PREPARE()
+# 
+# USAGE: SALOME_CONFIGURE_PREPARE(pkg1 pkg2 ...)
+#
+# Prepare the variable that will be used to configure the file Salome<MODULE>Config.cmake,
+# namely:
+#    - _PREREQ_LIST      : the list of level 1 external prerequisites
+#    - _PREREQ_DIR_LIST  : their corresponding CMake directories (i.e. where the CMake configuration
+#    file for this package can be found, if there is any!)
+#    - _PREREQ_COMPO_LIST: the list of components requested when this package was invoked
+#
+# All this information is built from the package_list, the list of level 1 packages for this module.
+# Only the packages found in CONFIG mode are retained.
+#
+MACRO(SALOME_CONFIGURE_PREPARE)
+  SET(_tmp_prereq "${ARGV}")
+  SET(_PREREQ_LIST)
+  SET(_PREREQ_DIR_LIST)
+  SET(_PREREQ_COMPO_LIST)
+  FOREACH(_prereq IN LISTS _tmp_prereq)
+    IF(${_prereq}_DIR)
+      SET(_PREREQ_LIST "${_PREREQ_LIST} ${_prereq}")
+      SET(_PREREQ_DIR_LIST "${_PREREQ_DIR_LIST} \"${${_prereq}_DIR}\"")
+      SALOME_APPEND_LIST_OF_LIST(_PREREQ_COMPO_LIST Salome${_prereq}_COMPONENTS)
+    ENDIF()
+  ENDFOREACH()
+ENDMACRO(SALOME_CONFIGURE_PREPARE)
+