From 85af926ddc5f3c8fb438001743e65ec3a039ceec Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Sun, 2 Oct 2016 00:23:07 -0400 Subject: [PATCH] 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. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbaad07..2a74c50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)