]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CMake:
authormpa <mpa@opencascade.com>
Tue, 3 Dec 2013 14:18:29 +0000 (14:18 +0000)
committermpa <mpa@opencascade.com>
Tue, 3 Dec 2013 14:18:29 +0000 (14:18 +0000)
-edit SALOME_GENERATE_TESTS_ENVIRONMENT macro.

salome_adm/cmake_files/SalomeMacros.cmake

index 7d2104e424854270855c4759ae54f8a5e78468ee..f79dbcf526898a47c762a4f11d3d23f87306d168 100755 (executable)
@@ -801,32 +801,56 @@ ENDMACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT)
 # 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)
-        SET(_env_${_item} "${_val};${_env_${_item}}")
-      ELSE()
-        SET(_env_${_item} "${_val}:${_env_${_item}}")
-      ENDIF()
-    ENDFOREACH()
-  ENDFOREACH()
+ 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()
+ 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()
+     SET(_env "${_item}=$ENV{${_item}}:${_env_${_item}}${sep}${_env}")
+   ENDIF()
+ ENDFOREACH()
+
+ # Get module name as substring of "Salome<ModuleName>"
+ STRING(SUBSTRING "${PROJECT_NAME}" 6 -1 PRNAME) 
+ 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()
 
-  IF(_WIN_LD_LIBRARY AND WIN32)
-    SET(_env_PATH "${_env_PATH} ${_env_LD_LIBRARY_PATH}")
-  ENDIF()
+ SET(${output} "${_env}")
 
-  FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
-    IF(NOT(WIN32 AND ${_item} STREQUAL "LD_LIBRARY_PATH"))
-      SET(_env "${_item}=${_env_${_item}} ${_env}")
-    ENDIF()
-  ENDFOREACH()
-  SET(${output} ${_env})  
 ENDMACRO(SALOME_GENERATE_TESTS_ENVIRONMENT) 
 
 #########################################################################