From: mpa Date: Tue, 29 Oct 2013 06:36:12 +0000 (+0000) Subject: CMake - Add new macros: X-Git-Tag: BR_hydro_v_0_3_1~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9c27a238d847278355b80c94a05e4a7535286bdf;p=modules%2Fkernel.git CMake - Add new macros: - Accumulate environment variables, to be used later to run some command in proper environment. - Generate environement script using previously created variables. --- diff --git a/salome_adm/cmake_files/SalomeMacros.cmake b/salome_adm/cmake_files/SalomeMacros.cmake index 75c291ffd..3c1f325bb 100755 --- a/salome_adm/cmake_files/SalomeMacros.cmake +++ b/salome_adm/cmake_files/SalomeMacros.cmake @@ -640,24 +640,23 @@ ENDMACRO(SALOME_ACCUMULATE_HEADERS) ######################################################################### # SALOME_ACCUMULATE_ENVIRONMENT() # -# USAGE: SALOME_ACCUMULATE_ENVIRONMENT(var value) +# USAGE: SALOME_ACCUMULATE_ENVIRONMENT(envvar value [value ...]) # # ARGUMENTS: -# var [in] environment variable name, e.g. PATH -# value [in] value(s) to be added to environment variable +# envvar [in] environment variable name, e.g. PATH +# value [in] value(s) to be added to environment variable # # This macro is called in the various FindSalomeXYZ.cmake modules to # accumulate environment variables, to be used later to run some command # in proper environment. # # 1. Each envrironment variable is stored in specific CMake variable -# _${PROJECT_NAME}_EXTRA_ENV_ -# where is name of variable. +# _${PROJECT_NAME}_EXTRA_ENV_, where is name of variable. # 2. Full list of environment variable names is stored in CMake variable -# _${PROJECT_NAME}_EXTRA_ENV. +# _${PROJECT_NAME}_EXTRA_ENV. # -MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar val) - FOREACH(_item ${val}) +MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar) + FOREACH(_item ${ARGN}) LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item} _res) IF(_res EQUAL -1) LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item}) @@ -673,6 +672,58 @@ MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar val) ENDFOREACH() ENDMACRO(SALOME_ACCUMULATE_ENVIRONMENT) +######################################################################### +# SALOME_GENERATE_ENVIRONMENT_SCRIPT() +# +# USAGE: SALOME_GENERATE_ENVIRONMENT_SCRIPT(output script cmd opts) +# +# ARGUMENTS: +# output [out] output command, e.g. for creation of target. +# script [in] output environement script name +# cmd [in] input command, e.g. sphinx or python command. +# opts [in] options for input command (cmd). +# +# This macro is called when it's necessary to use given environment to run some command. +# Macro generates environement script using previously created variables +# _${PROJECT_NAME}_EXTRA_ENV_, where is name of variable and +# _${PROJECT_NAME}_EXTRA_ENV (see marco SALOME_ACCUMULATE_ENVIRONMENT); +# and puts generated command in proper environment into argument. +# +# Notes: +# - If