From: bruneton Date: Mon, 28 Oct 2013 14:42:29 +0000 (+0000) Subject: CMake: new macro SALOME_CONFIGURE_PREPARE() to build the list of required variables X-Git-Tag: BR_hydro_v_0_3_1~53 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07cceca191e583a53eb158499fb125875e9b33f7;p=modules%2Fkernel.git CMake: new macro SALOME_CONFIGURE_PREPARE() to build the list of required variables that will be expanded when configuring SalomeConfig.cmake --- diff --git a/salome_adm/cmake_files/FindSalomeVTK.cmake b/salome_adm/cmake_files/FindSalomeVTK.cmake index b2fa8d12b..452ac9b4f 100644 --- a/salome_adm/cmake_files/FindSalomeVTK.cmake +++ b/salome_adm/cmake_files/FindSalomeVTK.cmake @@ -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)) diff --git a/salome_adm/cmake_files/SalomeMacros.cmake b/salome_adm/cmake_files/SalomeMacros.cmake index ef8d8a3f1..75c291ffd 100755 --- a/salome_adm/cmake_files/SalomeMacros.cmake +++ b/salome_adm/cmake_files/SalomeMacros.cmake @@ -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 SalomeConfig.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) +