From f8ea5e8aaf354cbd6785b89d9395fdc183d29921 Mon Sep 17 00:00:00 2001 From: maier Date: Wed, 10 Apr 2013 10:05:08 +0000 Subject: [PATCH] CMake: Improve construction of the rpath directive for Make.global_options git-svn-id: https://svn.dealii.org/trunk@29240 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/config/CMakeLists.txt | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 2364b73d81..7c3a913865 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -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: -- 2.39.5