File tree 1 file changed +11
-3
lines changed 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,18 @@ function(swift_get_set_rpath_script_file out_var)
4
4
set (${out_var} "${SWIFT_SET_RPATH_SCRIPT_FILE} " PARENT_SCOPE)
5
5
endfunction ()
6
6
7
- # Actual RPATH_SET operation to the file.
7
+ # Actual RPATH_CHANGE operation to the file.
8
8
function (_swift_set_rpath_impl file new_rpath)
9
- # NOTE: RPATH_SET is not documented, and works only for ELF and XCOFF.
10
- file (RPATH_SET FILE "${file} " NEW_RPATH "${new_rpath} " )
9
+ # FIXME: Handle non-ELF files. We can't use RPATH_SET because it's only available CMake 3.21.0
10
+ execute_process (
11
+ COMMAND readelf -Wd "${file} "
12
+ COMMAND grep -Po "R(UN)?PATH.*\\ [\\ K[^\\ ]]*"
13
+ OUTPUT_VARIABLE current_rpath
14
+ )
15
+ string (STRIP "${current_rpath} " current_rpath)
16
+
17
+ # NOTE: RPATH_CHANGE is not documented, and works only for ELF and XCOFF.
18
+ file (RPATH_CHANGE FILE "${file} " OLD_RPATH "${current_rpath} " NEW_RPATH "${new_rpath} " )
11
19
endfunction ()
12
20
13
21
# For 'cmake -P <scirpt>'.
You can’t perform that action at this time.
0 commit comments