From: mpa Date: Wed, 30 Oct 2013 12:22:50 +0000 (+0000) Subject: CMake: Edit salome macro X-Git-Tag: BR_hydro_v_0_3_1~46 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba520e13dc005608c3d624f6296cd026d6126820;p=modules%2Fkernel.git CMake: Edit salome macro - Now it's possible to accumulate environment without checked. - Native directories were not accumulated. - Is possible to add target to environment. --- diff --git a/salome_adm/cmake_files/SalomeMacros.cmake b/salome_adm/cmake_files/SalomeMacros.cmake index 4d1bc6a1b..7f48f7ba4 100755 --- a/salome_adm/cmake_files/SalomeMacros.cmake +++ b/salome_adm/cmake_files/SalomeMacros.cmake @@ -655,23 +655,42 @@ ENDMACRO(SALOME_ACCUMULATE_HEADERS) # 2. Full list of environment variable names is stored in CMake variable # _${PROJECT_NAME}_EXTRA_ENV. # +# Notes: +# - If in arguments is set keyword CHECK all argument after checked for directory, +# else if NOT_CHECK macro accumulates arguments without checking. +# By default all arguments without keyword must be checked. +# MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar) + SET(_is_check ON) FOREACH(_item ${ARGN}) - IF(EXISTS ${_item}) - IF(IS_DIRECTORY ${_item}) + IF(${_item} STREQUAL "NOT_CHECK") + SET(_is_check OFF) + ELSEIF(${_item} STREQUAL "CHECK") + SET(_is_check ON) + ELSE() + IF(_is_check) + IF(NOT IS_DIRECTORY ${_item}) + IF(TARGET ${_item}) + GET_TARGET_PROPERTY(_item ${_item} LOCATION) + ENDIF() + GET_FILENAME_COMPONENT(_item ${_item} PATH) + ENDIF() + IF(EXISTS ${_item}) + STRING(REGEX MATCH "^/usr" _usr_find ${_item}) + LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item} _res) + IF(NOT _usr_find AND _res EQUAL -1) + LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item}) + ENDIF() + ENDIF() + ELSE(_is_check) LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item} _res) - IF(_res EQUAL -1) + IF( _res EQUAL -1) LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item}) - ENDIF() - ELSE() - GET_FILENAME_COMPONENT(_path_dir ${_item} PATH) - LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_path_dir} _res) - IF(_res EQUAL -1) - LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_path_dir}) - ENDIF() - ENDIF() - ENDIF() + ENDIF() + ENDIF(_is_check) + ENDIF() ENDFOREACH() + LIST(FIND _${PROJECT_NAME}_EXTRA_ENV ${envvar} _res) IF(_res EQUAL -1) LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV ${envvar})