File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 22# SPDX-License-Identifier: Apache-2.0
33
44function (set_test_properties test_target)
5+ # See comments in set_tools_properties() in ../tools/CMakeLists.txt.
56 if (APPLE )
67 set_target_properties (${test_target} PROPERTIES
78 INSTALL_RPATH "@executable_path;/usr/local/lib"
89 )
10+ elseif (LINUX)
11+ set_target_properties (${test_target} PROPERTIES
12+ INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib"
13+ )
914 endif ()
1015endfunction ()
1116
Original file line number Diff line number Diff line change @@ -15,9 +15,35 @@ function(set_tool_properties tool_target)
1515 if (APPLE )
1616 set_target_properties (${tool_target} PROPERTIES
1717 XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES"
18+ # Creates an LC_RPATH entry in the Mac-O binary for each
19+ # item in this list. When searching for libraries whose
20+ # install name starts with @rpath, as libktx's does, dyld
21+ # searches each LC_RPATH in the order given here.
22+ #
23+ # Check the LC_RPATH entries with
24+ # - otool -l <file> | grep -A 3 LC_RPATH
25+ #
26+ # TODO: Consider adding @executable_path/../lib.
1827 INSTALL_RPATH "@executable_path;/usr/local/lib"
1928 CXX_VISIBILITY_PRESET ${STATIC_APP_LIB_SYMBOL_VISIBILITY}
2029 )
30+ elseif (LINUX)
31+ set_target_properties (${tool_target} PROPERTIES
32+ # With modern tools sets DT_RUNPATH not the deprecated
33+ # DT_RPATH in ELF binaries. ld.so searches for libraries
34+ # as follows:
35+ # - LD_LIBRARY_PATH
36+ # - RUNPATH
37+ # - Directories given in /etc/ld.so.conf.
38+ # /usr/local/lib is listed there.
39+ # - Default path: /lib;/usr/lib.
40+ # $ORIGIN is equivalent to @executable_path.
41+ #
42+ # Check DT_RUNPATH with one of
43+ # - readelf -d <file> | head -20
44+ # - objdump -x <file> | grep 'R.*PATH'
45+ INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib"
46+ )
2147 endif ()
2248endfunction ()
2349
You can’t perform that action at this time.
0 commit comments