summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-02-22 00:54:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-02-22 00:54:14 +0000
commitc94f3ae0278dc781cd60051790bf8a8003a13873 (patch)
tree3a9ef2723bd4f7df6c8ee2b9c76c4e3c26eab2a3 /CMakeLists.txt
parent341149ae85564f1c101f7bf5a6f93b9b5bd58583 (diff)
downloadllvm-c94f3ae0278dc781cd60051790bf8a8003a13873.tar.gz
llvm-c94f3ae0278dc781cd60051790bf8a8003a13873.tar.bz2
llvm-c94f3ae0278dc781cd60051790bf8a8003a13873.tar.xz
Use relative rpath so that the installation and build dirs are relocatable.
This works by asking cmake to use the "install rpath", but setting that rpath to be relative. Thanks a lot to Brad King for the help with CMake! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd8b363f7a..21c64b0b92 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -423,9 +423,13 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
-if( NOT DEFINED CMAKE_INSTALL_RPATH )
- set( CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
-endif( NOT DEFINED CMAKE_INSTALL_RPATH )
+set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
+if (APPLE)
+ set(CMAKE_INSTALL_NAME_DIR "@rpath")
+ set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
+else(UNIX)
+ set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
+endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)