MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG SALOME_INSTALL_AMCONFIG_LOCAL)
# Accumulate environment variables for KERNEL module
-SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
- ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}
- ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED})
-SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
+INSERT_INTO_MAP(${PROJECT_NAME}_OWN_ENV PYTHONPATH ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
+ ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}
+ ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED})
+INSERT_INTO_MAP(${PROJECT_NAME}_OWN_ENV LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
# For salome test
SET(KERNEL_TEST_DIR ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
# Install the export set for use with the install-tree
INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE}"
FILE ${PROJECT_NAME}Targets.cmake)
+
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+MESSAGE("tests_env = ${tests_env}")
+
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(plugins_cmd env_script "${PYTHON_EXECUTABLE}" "${plugins_cmd_options}")
ENDIF()
SET(_env)
- FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
- FOREACH(_val ${_${PROJECT_NAME}_EXTRA_ENV_${_item}})
- IF(WIN32)
- IF(${_item} STREQUAL "LD_LIBRARY_PATH")
- SET(_item PATH)
- ENDIF()
- STRING(REPLACE "/" "\\" _env "${_env} @SET ${_item}=${_val};%${_item}%\n")
- ELSE(WIN32)
- SET(_env "${_env} export ${_item}=${_val}:\${${_item}}\n")
- ENDIF(WIN32)
+ SET(_env_vars ${PROJECT_NAME}_OWN_ENV _${PROJECT_NAME}_EXTRA_ENV)
+ FOREACH(_list ${_env_vars})
+ FOREACH(_item ${${_list}})
+ FOREACH(_val ${${_list}_${_item}})
+ IF(WIN32)
+ IF(${_item} STREQUAL "LD_LIBRARY_PATH")
+ SET(_item PATH)
+ ENDIF()
+ STRING(REPLACE "/" "\\" _env "${_env} @SET ${_item}=${_val};%${_item}%\n")
+ ELSE(WIN32)
+ SET(_env "${_env} export ${_item}=${_val}:\${${_item}}\n")
+ ENDIF(WIN32)
+ ENDFOREACH()
ENDFOREACH()
ENDFOREACH()
# and puts this variable into <output> argument.
#
MACRO(SALOME_GENERATE_TESTS_ENVIRONMENT output)
- SET(_env)
- SET(_WIN_LD_LIBRARY OFF)
- FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
- IF(${_item} STREQUAL "LD_LIBRARY_PATH")
- SET(_WIN_LD_LIBRARY ON)
- ENDIF()
- SET(_env_${_item})
- FOREACH(_val ${_${PROJECT_NAME}_EXTRA_ENV_${_item}})
- IF(WIN32)
- STRING(REPLACE "/" "\\" _val "${_val}")
- SET(_env_${_item} "${_val};${_env_${_item}}")
- ELSE()
- SET(_env_${_item} "${_val}:${_env_${_item}}")
- ENDIF()
- ENDFOREACH()
- ENDFOREACH()
-
- IF(_WIN_LD_LIBRARY AND WIN32)
- SET(_env_PATH "${_env_PATH}$ENV{LD_LIBRARY_PATH};${_env_LD_LIBRARY_PATH}")
- ENDIF()
-
- IF(WIN32)
- SET(sep ",")
- ELSE()
- SET(sep ";")
- ENDIF()
+ SET(_env)
+ SET(_WIN_LD_LIBRARY OFF)
+ SET(_env_vars ${PROJECT_NAME}_OWN_ENV _${PROJECT_NAME}_EXTRA_ENV)
+ FOREACH(_list ${_env_vars})
+ FOREACH(_item ${${_list}})
+ IF(${_item} STREQUAL "LD_LIBRARY_PATH")
+ SET(_WIN_LD_LIBRARY ON)
+ ENDIF()
+ SET(_env_${_list}_${_item})
+ FOREACH(_val ${${_list}_${_item}})
+ IF(WIN32)
+ STRING(REPLACE "/" "\\" _val "${_val}")
+ SET(_env_${_list}_${_item} "${_val};${_env_${_list}_${_item}}")
+ ELSE()
+ SET(_env_${_list}_${_item} "${_val}:${_env_${_list}_${_item}}")
+ ENDIF()
+ ENDFOREACH()
+ ENDFOREACH()
+ ENDFOREACH()
+
+ IF(_WIN_LD_LIBRARY AND WIN32)
+ SET(_env_PATH "${_env_PATH}$ENV{LD_LIBRARY_PATH};${_env_LD_LIBRARY_PATH}")
+ ENDIF()
+
+ IF(WIN32)
+ SET(sep ",")
+ ELSE()
+ SET(sep ";")
+ ENDIF()
- FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
- IF(WIN32)
- IF(NOT ${_item} STREQUAL "LD_LIBRARY_PATH")
- SET(_env "${_item}=$ENV{${_item}};${_env_${_item}}${sep}${_env}")
- ENDIF()
- ELSE()
- STRING(REPLACE ";" ":" _iii "$ENV{${_item}}")
- SET(_env "${_item}=${_iii}:${_env_${_item}}${sep}${_env}")
- ENDIF()
- ENDFOREACH()
-
- # Get module name as substring of "Salome<ModuleName>"
- STRING(REGEX MATCH "^Salome" _is_salome_project ${PROJECT_NAME})
- IF(_is_salome_project)
- STRING(SUBSTRING "${PROJECT_NAME}" 6 -1 PRNAME)
- ELSE()
- SET(PRNAME ${PROJECT_NAME})
- ENDIF()
- SET(_env "${PRNAME}_ROOT_DIR=${CMAKE_INSTALL_PREFIX}${sep}${_env}")
+ FOREACH(_list ${_env_vars})
+ FOREACH(_item ${${_list}})
+ IF(WIN32)
+ IF(NOT ${_item} STREQUAL "LD_LIBRARY_PATH")
+ SET(_env "${_item}=$ENV{${_item}};${_env_${_list}_${_item}}${sep}${_env}")
+ ENDIF()
+ ELSE()
+ STRING(REPLACE ";" ":" _iii "$ENV{${_item}}")
+ SET(_env "${_item}=${_iii}:${_env_${_list}_${_item}}${sep}${_env}")
+ ENDIF()
+ ENDFOREACH()
+ ENDFOREACH()
+
+ # Get module name as substring of "Salome<ModuleName>"
+ STRING(REGEX MATCH "^Salome" _is_salome_project ${PROJECT_NAME})
+ IF(_is_salome_project)
+ STRING(SUBSTRING "${PROJECT_NAME}" 6 -1 PRNAME)
+ ELSE()
+ SET(PRNAME ${PROJECT_NAME})
+ ENDIF()
+ SET(_env "${PRNAME}_ROOT_DIR=${CMAKE_INSTALL_PREFIX}${sep}${_env}")
- # Creating follow string for Windows environement:
- # "VAR1_ENV=1\;2\;3\;...\;...\;...;VAR2_ENV=1\;2\;3\;...\;...\;...;VAR3_ENV=1\;2\;3\;...\;...\;...;..."
- IF(WIN32)
- STRING(REGEX REPLACE "\\\\*;" "\\\\;" _env "${_env}")
- STRING(REGEX REPLACE "\\\\*;*," ";" _env "${_env}")
- ENDIF()
+ # Creating follow string for Windows environement:
+ # "VAR1_ENV=1\;2\;3\;...\;...\;...;VAR2_ENV=1\;2\;3\;...\;...\;...;VAR3_ENV=1\;2\;3\;...\;...\;...;..."
+ IF(WIN32)
+ STRING(REGEX REPLACE "\\\\*;" "\\\\;" _env "${_env}")
+ STRING(REGEX REPLACE "\\\\*;*," ";" _env "${_env}")
+ ENDIF()
- SET(${output} "${_env}")
+ SET(${output} "${_env}")
ENDMACRO(SALOME_GENERATE_TESTS_ENVIRONMENT)
ENDIF()
ENDFOREACH()
ENDMACRO(SALOME_CONFIGURE_PREPARE)
+
+#########################################################################
+# INSERT_INTO_MAP()
+#
+# USAGE: INSERT_INTO_MAP(name key values)
+#
+# ARGUMENTS:
+# name [in] input name of map
+# key [in] input key of map
+# values [in] input list of key values
+#
+# This macro emulates the creation of map [key]->[value]
+#
+MACRO(INSERT_INTO_MAP name key)
+ FOREACH(_value ${ARGN})
+ LIST(APPEND ${name}_${key} "${_value}")
+ ENDFOREACH()
+
+ LIST(FIND ${key} ${name} _res)
+ IF(_res EQUAL -1)
+ LIST(APPEND ${name} ${key})
+ ENDIF()
+ENDMACRO(INSERT_INTO_MAP)