]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Improve construction of the rpath directive for Make.global_options
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Apr 2013 10:05:08 +0000 (10:05 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Apr 2013 10:05:08 +0000 (10:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@29240 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/config/CMakeLists.txt

index 2364b73d81c8b687d39520e32a81190e2a46fc73..7c3a9138651ec67c8a32a86220716b14b09ed352 100644 (file)
@@ -183,10 +183,7 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES)
         ${_libs}
         )
 
-    #
-    # TODO: Come up with an idea how to get the link line directly from
-    # CMake...
-    #
+    SET(_paths)
     FOREACH(_lib
         $(D)/${DEAL_II_LIBRARY_RELDIR}/${CONFIG_LIBRARY_${build}}
         ${DEAL_II_EXTERNAL_LIBRARIES}
@@ -194,13 +191,24 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES)
         )
       LIST(APPEND MAKEFILE_LIBS_${build} ${_lib})
       #
-      # Add an rpath directive for each library:
+      # Extract library paths where possible:
       #
-      GET_FILENAME_COMPONENT(_path ${_lib} PATH)
-      LIST(APPEND MAKEFILE_LIBS_${build} "-Wl,-rpath,${_path}")
+      IF(_lib MATCHES "^/")
+        GET_FILENAME_COMPONENT(_path ${_lib} PATH)
+        LIST(APPEND _paths ${_path})
+      ENDIF()
+    ENDFOREACH()
+
+    #
+    # And build up an rpath:
+    #
+    SET(_rpath "-Wl,rpath,")
+    LIST(REMOVE_DUPLICATES _paths)
+    FOREACH(_path ${_paths})
+      SET(_rpath "${_rpath}${_path}:")
     ENDFOREACH()
 
-    TO_STRING(MAKEFILE_LIBS_${build} ${MAKEFILE_LIBS_${build}})
+    TO_STRING(MAKEFILE_LIBS_${build} ${MAKEFILE_LIBS_${build}} ${_rpath})
 
     #
     # Set up our linker flags:

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.