]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Add macro to accumulate environment variables
authorvsr <vsr@opencascade.com>
Fri, 25 Oct 2013 05:40:39 +0000 (05:40 +0000)
committervsr <vsr@opencascade.com>
Fri, 25 Oct 2013 05:40:39 +0000 (05:40 +0000)
SalomeKERNELConfig.cmake.in
salome_adm/cmake_files/FindSalomeKERNEL.cmake
salome_adm/cmake_files/SalomeMacros.cmake

index 6a51c6b8ae901cc9e56a7fdb98b6e71f0cc2db66..ac65b28b501a237d50b74e57ed47ccb81f80d8cd 100644 (file)
@@ -51,6 +51,9 @@ SET_AND_CHECK(KERNEL_INCLUDE_DIRS "${KERNEL_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADER
 SET(KERNEL_INCLUDE_DIRS "${KERNEL_INCLUDE_DIRS};@_SalomeKERNEL_EXTRA_HEADERS@")
 SET(KERNEL_DEFINITIONS)
 
+# Package specific environment variables
+@_SalomeKERNEL_EXTRA_ENV_FULL@
+
 #### Now the specificities
 
 # Options exported by the package:
@@ -180,5 +183,3 @@ SET(KERNEL_TOOLSDS TOOLSDS)
 SET(KERNEL_UtilsTest UtilsTest)
 SET(KERNEL_with_loggerTraceCollector with_loggerTraceCollector)
 SET(KERNEL_SalomeKernelHelpers SalomeKernelHelpers)
-
-
index 0f0ff81fcf641bcb7a4ba3e54a14864769ae5d7e..fcfb7756b69d1939782682e8360725649854cda7 100644 (file)
@@ -47,3 +47,7 @@ SALOME_FIND_PACKAGE(SalomeKERNEL SalomeKERNEL CONFIG)
 IF(NOT SalomeKERNEL_FIND_QUIETLY)
   MESSAGE(STATUS "Found Salome KERNEL: ${KERNEL_ROOT_DIR}")
 ENDIF()
+
+FOREACH(_res ${SalomeKERNEL_EXTRA_ENV})
+  SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeKERNEL_EXTRA_ENV_${_res}}")
+ENDFOREACH()
index 29bca1f9fc6e1be9cddc2ba41be57a42469b5728..ef8d8a3f1a14a960f1d89a3845e5ab8fc3ca652e 100755 (executable)
@@ -636,3 +636,40 @@ MACRO(SALOME_ACCUMULATE_HEADERS lst)
     ENDIF()
   ENDFOREACH()
 ENDMACRO(SALOME_ACCUMULATE_HEADERS)
+
+#########################################################################
+# SALOME_ACCUMULATE_ENVIRONMENT()
+# 
+# USAGE: SALOME_ACCUMULATE_ENVIRONMENT(var value)
+#
+# ARGUMENTS:
+#   var   [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_<var>
+# where <var> is name of variable.
+# 2. Full list of environment variable names is stored in CMake variable
+# _${PROJECT_NAME}_EXTRA_ENV.
+#
+MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar val)
+  FOREACH(_item ${val})
+    LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item} _res)
+    IF(_res EQUAL -1)
+      LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item})
+    ENDIF()
+  ENDFOREACH()
+  LIST(FIND _${PROJECT_NAME}_EXTRA_ENV ${envvar} _res)
+  IF(_res EQUAL -1)
+    LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV ${envvar})
+  ENDIF()
+  SET(_${PROJECT_NAME}_EXTRA_ENV_FULL "SET\(${PROJECT_NAME}_EXTRA_ENV ${_${PROJECT_NAME}_EXTRA_ENV}\)")
+  FOREACH(_res ${_${PROJECT_NAME}_EXTRA_ENV})
+    SET(_${PROJECT_NAME}_EXTRA_ENV_FULL "${_${PROJECT_NAME}_EXTRA_ENV_FULL}\nSET\(${PROJECT_NAME}_EXTRA_ENV_${_res} ${_${PROJECT_NAME}_EXTRA_ENV_${_res}}\)")
+  ENDFOREACH()
+ENDMACRO(SALOME_ACCUMULATE_ENVIRONMENT)
+