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

index b34e80a3598e088b8be02634830ba0c4ab2bfef2..7ab228727af528ce98e2b06c469deeed8b2b0768 100644 (file)
@@ -60,20 +60,28 @@ ELSE(WIN32)
     MESSAGE(FATAL_ERROR "Error in CPPUNIT detection ! cppunit-config executable not found !")
   ENDIF(NOT CPPUNIT_CONFIG_BIN)
   EXECUTE_PROCESS(COMMAND ${CPPUNIT_CONFIG_BIN} --libs OUTPUT_VARIABLE CPPUNIT_LDFLAGS)
-  STRING( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" CPPUNIT_TMP4 "${CPPUNIT_LDFLAGS}" )
-  IF(CPPUNIT_TMP4)
-    STRING( REGEX REPLACE "^-L" "" CPPUNIT_LIBRARY_DIRS ${CPPUNIT_TMP4})
-    LIST(APPEND CMAKE_LIBRARY_PATH ${CPPUNIT_LIBRARY_DIRS})
-  ENDIF(CPPUNIT_TMP4)
-  STRING( REGEX MATCHALL "-l([^\", \n]+)" CPPUNIT_TMP5 "${CPPUNIT_LDFLAGS}" )
-  FOREACH(LIB ${CPPUNIT_TMP5})
-    STRING(REGEX REPLACE "^-l" "" LIB2 ${LIB})
-    FIND_LIBRARY(CPPUNIT_SUBLIB_${LIB2} ${LIB2})
-    IF(NOT CPPUNIT_SUBLIB_${LIB2})
-      MESSAGE(FATAL_ERROR "Error in CPPUNIT detection ! Fail to locate the needed library ${LIB2} !")
-    ENDIF(NOT CPPUNIT_SUBLIB_${LIB2})
-    LIST(APPEND CPPUNIT_LIBRARIES ${CPPUNIT_SUBLIB_${LIB2}})
-  ENDFOREACH(LIB ${CPPUNIT_TMP5})
+  STRING(STRIP ${CPPUNIT_LDFLAGS} CPPUNIT_LDFLAGS)
+  STRING(REPLACE " " ";" LDFLAGS_LIST ${CPPUNIT_LDFLAGS})
+  FOREACH(LDFLAG ${LDFLAGS_LIST})
+    STRING(REGEX MATCH "^-L.*" LIBDIR "${LDFLAG}")
+    STRING(REGEX MATCH "^-l.*" LIB "${LDFLAG}")
+    IF(LIBDIR)
+      STRING(REGEX REPLACE "^-L" "" LIBDIR ${LIBDIR})
+      LIST(APPEND CMAKE_LIBRARY_PATH ${LIBDIR})
+    ELSEIF(LIB)
+      STRING(REGEX REPLACE "^-l" "" LIB ${LIB})
+      LIST(APPEND LIBS ${LIB})
+    ELSE()
+      MESSAGE(FATAL_ERROR "Unrecognized token \"${LDFLAG}\" in the output of cppunit-config --libs")
+    ENDIF()
+  ENDFOREACH(LDFLAG ${LDFLAGS_LIST})
+  FOREACH(LIB ${LIBS})
+    FIND_LIBRARY(CPPUNIT_SUBLIB_${LIB} ${LIB})
+    IF(NOT CPPUNIT_SUBLIB_${LIB})
+      MESSAGE(FATAL_ERROR "Error in CPPUNIT detection! Fail to locate the needed library ${LIB}!")
+    ENDIF(NOT CPPUNIT_SUBLIB_${LIB})
+    LIST(APPEND CPPUNIT_LIBRARIES ${CPPUNIT_SUBLIB_${LIB}})
+  ENDFOREACH(LIB ${LIBS})
 #  MESSAGE("**** ${CPPUNIT_LIBRARIES}")
 ENDIF(WIN32)
 
index 454728b568d3621205e61fa5ac77092ee485e8fb..707e04c0ec5791e793ed68348fd4697ed61791cc 100755 (executable)
@@ -798,18 +798,32 @@ ENDMACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT)
 #
 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 "${_val};${_env}")
+        SET(_env_${_item} "${_val};${_env_${_item}}")
       ELSE()
-        SET(_env "${_val}:${_env}")
+        SET(_env_${_item} "${_val}:${_env_${_item}}")
       ENDIF()
     ENDFOREACH()
-    SET(_env " ${_item}=${_env}")
-  ENDFOREACH() 
+  ENDFOREACH()
+
+  IF(_WIN_LD_LIBRARY AND WIN32)
+    SET(_env_PATH "${_env_PATH} ${_env_LD_LIBRARY_PATH}")
+  ENDIF()
+
+  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)
+ENDMACRO(SALOME_GENERATE_TESTS_ENVIRONMENT) 
 
 #########################################################################
 # SALOME_APPEND_LIST_OF_LIST()