From: bruneton Date: Mon, 4 Nov 2013 09:01:48 +0000 (+0000) Subject: CMake: improved reloading of dependent CMake targets in Config file to X-Git-Tag: V7_3_0a1~37 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0c83e37b07b3d910543bdcc444fe27e18f876549;p=modules%2Fmed.git CMake: improved reloading of dependent CMake targets in Config file to account for COMPONENTS. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 13105ef33..f3dfd0af5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,6 +346,11 @@ SET(XDR_ROOT_DIR "${XDR_ROOT_DIR}") # Get the relative path of the include directory so # we can register it in the generated configuration files: SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}") + +# Build variables that will be expanded when configuring SalomeConfig.cmake: +SALOME_CONFIGURE_PREPARE(Metis ParMetis Scotch XDR CAS Qt4 CppUnit Graphviz Doxygen Sphinx MPI omniORB + PThread Boost libXml2 Python HDF5 MEDFile) + CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}_LOCAL" diff --git a/SalomeMEDConfig.cmake.in b/SalomeMEDConfig.cmake.in index 870da99c6..ba7c9aba9 100644 --- a/SalomeMEDConfig.cmake.in +++ b/SalomeMEDConfig.cmake.in @@ -81,27 +81,29 @@ ENDIF(SALOME_MED_BUILD_GUI) # 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. -# Many of them will be automatically loaded from KERNEL or GUI: - -SET(_PREREQ Metis ParMetis Scotch XDR CAS Qt4 CppUnit Graphviz Doxygen Sphinx MPI omniORB - PThread Boost libXml2 Python HDF5 MEDFile) -SET(_PREREQ_CONFIG_DIR "@Metis_DIR@" "@ParMetis_DIR@" "@Scotch_DIR@" "@XDR_DIR@" "@CAS_DIR@" "@Qt4_DIR@" - "@CppUnit_DIR@" "@Graphviz_DIR@" "@Doxygen_DIR@" "@Sphinx_DIR@" "@MPI_DIR@" - "@omniORB_DIR@" "@PThread_DIR@" "@Boost_DIR@" "@libXml2_DIR@" - "@Python_DIR@" "@HDF5_DIR@" "@MEDFile_DIR@") - +# without having to set LD_LIBRARY_PATH: +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()