summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Darwin.cmake
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2013-04-27 04:04:44 (GMT)
committerBrad King <brad.king@kitware.com>2013-06-03 13:42:05 (GMT)
commit94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18 (patch)
tree4676709c61c7f1d8352f5e9729bb875cb2816e34 /Modules/Platform/Darwin.cmake
parentcbe3f2072bdd181660bc4f9174a73febd3ed5230 (diff)
downloadCMake-94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18.zip
CMake-94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18.tar.gz
CMake-94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18.tar.bz2
OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH property turned on. For install time, it is also useful to set INSTALL_RPATH to help find dependent libraries with an @rpath in their install name. Also adding detection of rpath conflicts when using frameworks.
Diffstat (limited to 'Modules/Platform/Darwin.cmake')
-rw-r--r--Modules/Platform/Darwin.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 6e5d449..f0652b9 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -30,6 +30,11 @@ set(CMAKE_SHARED_MODULE_SUFFIX ".so")
set(CMAKE_MODULE_EXISTS 1)
set(CMAKE_DL_LIBS "")
+# Enable rpath support for 10.5 and greater where it is known to work.
+if("${DARWIN_MAJOR_VERSION}" GREATER 8)
+ set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
+endif()
+
set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")