Enable rpath on OS X when the CMake version supports it (#418)

CMake policy CMP0042 changes the default value of the MACOSX_RPATH target property to TRUE, therefore setting the directory portion of the install_name field of a shared library to be @rpath on OS X.
This commit is contained in:
Jamie Snape
2016-10-02 00:23:07 -04:00
committed by Jesse Beder
parent 519d33fea3
commit 85af926ddc

View File

@@ -12,6 +12,11 @@ endif()
if(POLICY CMP0015)
cmake_policy(SET CMP0015 OLD)
endif()
# see https://cmake.org/cmake/help/latest/policy/CMP0042.html
if(POLICY CMP0042)
# Enable MACOSX_RPATH by default.
cmake_policy(SET CMP0042 NEW)
endif()
include(CheckCXXCompilerFlag)