OS X: Search for SDK based on deployment target (#14324)

When available, use CMAKE_OSX_DEPLOYMENT_TARGET instead of the host OS X
version to select the default SDK.  This makes sense because one should
use the SDK matching the deployment target.

Suggested-by: John Ralls <jralls@ceridwen.us>
This commit is contained in:
Brad King 2013-08-02 14:00:13 -04:00
parent b341bf2178
commit 95f78e08fe
1 changed files with 5 additions and 1 deletions

View File

@ -132,7 +132,11 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode
# specially named SDKs. # specially named SDKs.
set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u")
set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9") set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.3 ".9")
set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}}) if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(_CMAKE_OSX_SDKS_VER ${CMAKE_OSX_DEPLOYMENT_TARGET}${_CMAKE_OSX_SDKS_VER_SUFFIX_${CMAKE_OSX_DEPLOYMENT_TARGET}})
else()
set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
endif()
set(_CMAKE_OSX_SYSROOT_DEFAULT set(_CMAKE_OSX_SYSROOT_DEFAULT
"${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
else() else()