From: bruneton Date: Mon, 28 Oct 2013 14:43:47 +0000 (+0000) Subject: CMake: invoking SALOME_CONFIGURE_PREPARE() macro and adapted SalomeGUIConfig.cmake X-Git-Tag: BR_hydro_v_0_3_1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cdd045b5fcbbdd91a11d1b835a6a8fb79bd3a8a6;p=modules%2Fgui.git CMake: invoking SALOME_CONFIGURE_PREPARE() macro and adapted SalomeGUIConfig.cmake so that the reloading of level-1-prerequisite targets takes into account the component list (typically needed for VTK). --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 04c999c99..bee2f53d5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,6 +300,11 @@ 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 SalomeConfig.cmake: +SALOME_CONFIGURE_PREPARE(CAS OpenGL PyQt4 Qt4 Qwt SIP VTK) +message("_PREREQ_LIST ${_PREREQ_LIST}") + CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" diff --git a/SalomeGUIConfig.cmake.in b/SalomeGUIConfig.cmake.in index ff024cda2..b8493d58a 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -80,19 +80,28 @@ ENDIF() # 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 CAS OpenGL PyQt4 Qt4 Qwt SIP VTK) -SET(_PREREQ_CONFIG_DIR "@CAS_DIR@" "@OpenGL_DIR@" "@PyQt4_DIR@" "@Qt4_DIR@" "@Qwt_DIR@" "@SIP_DIR@" "@VTK_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()