]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Synchronize adm files
authorinv <inv@opencascade.com>
Fri, 25 Oct 2013 17:12:34 +0000 (17:12 +0000)
committerinv <inv@opencascade.com>
Fri, 25 Oct 2013 17:12:34 +0000 (17:12 +0000)
adm_local_without_kernel/cmake_files/SalomeMacros.cmake

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)
+