]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Adaptation of setting of environment for unit tests on Windows
authormpv <mpv@opencascade.com>
Thu, 22 Oct 2015 11:19:55 +0000 (14:19 +0300)
committermpv <mpv@opencascade.com>
Thu, 22 Oct 2015 11:19:55 +0000 (14:19 +0300)
CMakeCommon/UnitTest.cmake

index 636adcc856a0de3b1098244cd6349341da4d53de..57dc2924673f9301ec382df86b816dd432c85396 100644 (file)
 ENABLE_TESTING()
 
 MACRO(ADD_UNIT_TESTS)
-  SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin:${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/plugins:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
-  SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/plugins:${CMAKE_INSTALL_PREFIX}/addons:${CMAKE_INSTALL_PREFIX}/pythonAPI:$ENV{PYTHONPATH}")
+  if (WIN32) # different separators and path to libraries variable name
+    SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/bin;${CMAKE_INSTALL_PREFIX}/swig;${CMAKE_INSTALL_PREFIX}/plugins;${SUIT_LIB_DIR};$ENV{PATH}")
+    STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
+    STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
+    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/swig;${CMAKE_INSTALL_PREFIX}/plugins;${CMAKE_INSTALL_PREFIX}/addons;${CMAKE_INSTALL_PREFIX}/pythonAPI;$ENV{PYTHONPATH}")
+    STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
+    STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
+  else()
+    SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin:${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/plugins:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
+    SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/swig:${CMAKE_INSTALL_PREFIX}/plugins:${CMAKE_INSTALL_PREFIX}/addons:${CMAKE_INSTALL_PREFIX}/pythonAPI:$ENV{PYTHONPATH}")
+  endif()
+
   SET(_CONFIG_FILE "${CMAKE_INSTALL_PREFIX}/plugins")
   foreach(eachFileName ${ARGN})
     # Strip the ".py" suffix 
@@ -42,8 +52,13 @@ MACRO(ADD_UNIT_TESTS)
     IF(EXISTS ${aTestFileName})
       ADD_TEST(NAME ${aTestName}
                COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName})
-      SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+      if (WIN32) # different path to libraries variable name
+        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
+               ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};NEW_GEOM_CONFIG_FILE=${_CONFIG_FILE}")
+      else()
+        SET_TESTS_PROPERTIES(${aTestName} PROPERTIES
                ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};NEW_GEOM_CONFIG_FILE=${_CONFIG_FILE}")
+      endif()
       # Debug output...
       #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}")
     ELSE(EXISTS ${aTestFileName})