diff --git a/CMakeLists.txt b/CMakeLists.txt index d78bca01..47afd9e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0) if(NOT CMAKE_VERSION VERSION_LESS 3.0) cmake_policy(SET CMP0042 NEW) endif() +if (NOT CMAKE_VERSION VERSION_LESS 3.9) + cmake_policy(SET CMP0068 NEW) +endif() # add some default value for some additional macOS variable # note that those variables are ignored on other systems @@ -394,9 +397,14 @@ else() # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle # NOTE: it's not required to link against SFML.framework - set_target_properties(SFML PROPERTIES - BUILD_WITH_INSTALL_RPATH 1 - INSTALL_NAME_DIR "@rpath") + set_target_properties(SFML PROPERTIES INSTALL_NAME_DIR "@rpath") + if(NOT CMAKE_SKIP_BUILD_RPATH) + if (CMAKE_VERSION VERSION_LESS 3.9) + set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) + else() + set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) + endif() + endif() # install rule install(TARGETS SFML diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 2382ea43..fa2b78b3 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -123,13 +123,13 @@ macro(sfml_add_library target) # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle # but only if cmake rpath options aren't set if(NOT CMAKE_SKIP_RPATH AND NOT CMAKE_SKIP_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH AND NOT CMAKE_INSTALL_NAME_DIR) - if(CMAKE_SKIP_BUILD_RPATH) - set_target_properties(${target} PROPERTIES - INSTALL_NAME_DIR "@rpath") - else() - set_target_properties(${target} PROPERTIES - BUILD_WITH_INSTALL_RPATH 1 - INSTALL_NAME_DIR "@rpath") + set_target_properties(${target} PROPERTIES INSTALL_NAME_DIR "@rpath") + if(NOT CMAKE_SKIP_BUILD_RPATH) + if (CMAKE_VERSION VERSION_LESS 3.9) + set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) + else() + set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) + endif() endif() endif() endif()