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) if(NOT CMAKE_VERSION VERSION_LESS 3.0)
cmake_policy(SET CMP0042 NEW) cmake_policy(SET CMP0042 NEW)
endif() endif()
if (NOT CMAKE_VERSION VERSION_LESS 3.9)
cmake_policy(SET CMP0068 NEW)
endif()
# add some default value for some additional macOS variable # add some default value for some additional macOS variable
# note that those variables are ignored on other systems # 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 # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
# NOTE: it's not required to link against SFML.framework # NOTE: it's not required to link against SFML.framework
set_target_properties(SFML PROPERTIES set_target_properties(SFML PROPERTIES INSTALL_NAME_DIR "@rpath")
BUILD_WITH_INSTALL_RPATH 1 if(NOT CMAKE_SKIP_BUILD_RPATH)
INSTALL_NAME_DIR "@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 rule
install(TARGETS SFML 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 # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
# but only if cmake rpath options aren't set # 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(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")
set_target_properties(${target} PROPERTIES if(NOT CMAKE_SKIP_BUILD_RPATH)
INSTALL_NAME_DIR "@rpath") if (CMAKE_VERSION VERSION_LESS 3.9)
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
else() else()
set_target_properties(${target} PROPERTIES set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE)
BUILD_WITH_INSTALL_RPATH 1 endif()
INSTALL_NAME_DIR "@rpath")
endif() endif()
endif() endif()
endif() endif()