From ac0786cb9ae40f73323b448e405b053a83770de0 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Sun, 5 Mar 2017 00:05:06 +0100 Subject: BundleUtilities: Teach `get_item_rpaths` to parse ELF binaries --- Modules/BundleUtilities.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) 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() -- cgit v0.12