summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-10-07 19:58:28 (GMT)
committerBrad King <brad.king@kitware.com>2018-10-26 13:25:51 (GMT)
commit6114d85a7db0571bfade96a710f34a01bb2037c8 (patch)
tree6ce358b1f2cab1fbe0716a53546663e584565b77 /Modules/Platform
parentbba42bb91e25a35791e71461858403360192778b (diff)
downloadCMake-6114d85a7db0571bfade96a710f34a01bb2037c8.zip
CMake-6114d85a7db0571bfade96a710f34a01bb2037c8.tar.gz
CMake-6114d85a7db0571bfade96a710f34a01bb2037c8.tar.bz2
RPATH: Add option for using $ORIGIN in build tree
This makes binaries independent of the build directory by not embedding the build directory via RPATH. The tests are partially based on the existing RuntimePath test, but with the check moved into a POST_BUILD command such that it can be skipped when the platform lacks support. Fixes: #18413
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Linux.cmake1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index 1f8c1b4..b5d5464 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -1,6 +1,7 @@
set(CMAKE_DL_LIBS "dl")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")