Xcode: Adjust deployment target SDK version to host version

If the automatically selected SDK is newer than the host OS version
and no deployment version has been set then adjust the deployment
version to the host OS version. Otherwise the user won't be able to
launch the executables on the build host.

This is for example a problem on a MacOSX 10.10 host with Xcode 7
which only provides a MacOSX10.11 SDK.
This commit is contained in:
Gregor Jasny 2015-10-11 12:07:25 +02:00 committed by Brad King
parent 679a5d2185
commit 24aafbde11

View File

@ -100,6 +100,10 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode
"Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
)
endif()
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET AND _CURRENT_OSX_VERSION VERSION_LESS _CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${_CURRENT_OSX_VERSION} CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value." FORCE)
endif()
else()
# Assume developer files are in root (such as Xcode 4.5 command-line tools).
set(_CMAKE_OSX_SYSROOT_DEFAULT "")