summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-13 12:59:54 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-03-13 12:59:59 (GMT)
commit3806e186d1ac3efabcbd3237927fc660645fdc26 (patch)
treec46b7289de0831015cdff1afde13a7521300a77d /Modules
parent22908e4be83679deb32cf771df9d7793681814fd (diff)
parent10fcef02752ad46b53dd22025420048a0278322d (diff)
downloadCMake-3806e186d1ac3efabcbd3237927fc660645fdc26.zip
CMake-3806e186d1ac3efabcbd3237927fc660645fdc26.tar.gz
CMake-3806e186d1ac3efabcbd3237927fc660645fdc26.tar.bz2
Merge topic 'BundleUtilities-elf-rpath'
10fcef02 BundleUtilities: Fix bundle verification on Unix by considering rpaths. ac0786cb BundleUtilities: Teach `get_item_rpaths` to parse ELF binaries a52faa1f file: Add READ_ELF command to parse ELF binaries Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !551
Diffstat (limited to 'Modules')
-rw-r--r--Modules/BundleUtilities.cmake13
1 files changed, 12 insertions, 1 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 5d6f402..121a8f0 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()
@@ -998,7 +1008,8 @@ function(verify_bundle_prerequisites bundle result_var info_var)
endif()
if(NOT ignoreFile)
- get_prerequisites("${f}" prereqs 1 1 "${exepath}" "")
+ get_item_rpaths(${f} _main_exe_rpaths)
+ get_prerequisites("${f}" prereqs 1 1 "${exepath}" "${_main_exe_rpaths}")
# On the Mac,
# "embedded" and "system" prerequisites are fine... anything else means