Fix CMake warning on macOS since CMake 3.9

This commit is contained in:
Ceylo 2018-02-10 18:07:21 +01:00 committed by eXpl0it3r
parent f963faa694
commit 8b7a50a914
2 changed files with 18 additions and 10 deletions

View File

@ -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

View File

@ -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()