]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
CMake: improved reloading of dependent CMake targets in Config file to
authorbruneton <bruneton>
Mon, 4 Nov 2013 09:01:57 +0000 (09:01 +0000)
committerbruneton <bruneton>
Mon, 4 Nov 2013 09:01:57 +0000 (09:01 +0000)
account for COMPONENTS.

CMakeLists.txt
SalomePARAVISConfig.cmake.in

index 7d0c3f3a85836162f86b909a4ab460c7e6a78931..b7ee3751959982fc3f580ac07598fd2d6ca37a49 100644 (file)
@@ -259,6 +259,10 @@ SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
 SET(QWT_ROOT_DIR "${QWT_ROOT_DIR}")
  
 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
+
+# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
+SALOME_CONFIGURE_PREPARE(MEDFile)
+
 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in 
     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
index 495b8279eb5aa0177b9ed533b70581f8efe27e69..d90d4bac980127294977f77f2cc66598de185bc2 100644 (file)
@@ -73,19 +73,28 @@ SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT4_ROOT_DIR@")
 # For all prerequisites, load the corresponding targets if the package was used 
 # in CONFIG mode. This ensures dependent projects link correctly
 # without having to set LD_LIBRARY_PATH:
-SET(_PREREQ )
-SET(_PREREQ_CONFIG_DIR )
+SET(_PREREQ @_PREREQ_LIST@)
+SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@)
+SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@")
 LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
 # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
 MATH(EXPR _range "${_list_len}-1")
 FOREACH(_p RANGE ${_range})  
   LIST(GET _PREREQ            ${_p} _pkg    )
   LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
-  IF(_pkg_dir)
-     MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
-     FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE 
+  LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo)
+  MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
+  IF(NOT _pkg_compo)
+    FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE 
           PATHS "${_pkg_dir}" 
           NO_DEFAULT_PATH)
+  ELSE()
+    STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}")
+    MESSAGE(STATUS "===> (components: ${_pkg_compo})")
+    FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
+          COMPONENTS ${_compo_lst} 
+          PATHS "${_pkg_dir}"
+          NO_DEFAULT_PATH)
   ENDIF()
 ENDFOREACH()