summaryrefslogtreecommitdiffstats
path: root/Modules/BundleUtilities.cmake
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2017-03-04 23:05:06 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-10 15:59:07 (GMT)
commitac0786cb9ae40f73323b448e405b053a83770de0 (patch)
treef3932c69c1dd4e22e3aae53b5d12c6ddb308379d /Modules/BundleUtilities.cmake
parenta52faa1fcb7b54026ecfbef573d05568846e1aba (diff)
downloadCMake-ac0786cb9ae40f73323b448e405b053a83770de0.zip
CMake-ac0786cb9ae40f73323b448e405b053a83770de0.tar.gz
CMake-ac0786cb9ae40f73323b448e405b053a83770de0.tar.bz2
BundleUtilities: Teach `get_item_rpaths` to parse ELF binaries
Diffstat (limited to 'Modules/BundleUtilities.cmake')
-rw-r--r--Modules/BundleUtilities.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 5d6f402..1ec06f1 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -432,6 +432,16 @@ function(get_item_rpaths item rpaths_var)
endif()
endif()
+ if(UNIX AND NOT APPLE)
+ file(READ_ELF ${item} RPATH rpath_var RUNPATH runpath_var CAPTURE_ERROR error_var)
+ get_filename_component(item_dir ${item} DIRECTORY)
+ foreach(rpath ${rpath_var} ${runpath_var})
+ # Substitute $ORIGIN with the exepath and add to the found rpaths
+ string(REPLACE "$ORIGIN" "${item_dir}" rpath "${rpath}")
+ gp_append_unique(${rpaths_var} "${rpath}")
+ endforeach()
+ endif()
+
set(${rpaths_var} ${${rpaths_var}} PARENT_SCOPE)
endfunction()