From 95f78e08febc541ec9f1d1b57e57c1c639c2d50a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Aug 2013 14:00:13 -0400 Subject: [PATCH 1/2] 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 --- Modules/Platform/Darwin.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index f0652b90a..865cc8e6d 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -132,7 +132,11 @@ elseif("${CMAKE_GENERATOR}" MATCHES Xcode # specially named SDKs. set(_CMAKE_OSX_SDKS_VER_SUFFIX_10.4 "u") 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 "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk") else() From bf5a5bc8b4788a236a53037c2f8a03904edf6079 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 2 Aug 2013 15:54:03 -0400 Subject: [PATCH 2/2] bootstrap: Do not suppress CMAKE_OSX_SYSROOT if CFLAGS have -isysroot (#14324) Revert commit a1c032b9 (bootstrap: Suppress CMAKE_OSX_SYSROOT if CFLAGS have -isysroot, 2012-09-21). If MACOSX_DEPLOYMENT_TARGET is set then CMAKE_OSX_DEPLOYMENT_TARGET will be set and Darwin.cmake will complain if no CMAKE_OSX_SYSROOT is set. Just allow both -isysroot flags to appear. The one generated by CMAKE_OSX_SYSROOT appears after and overrides the one from CFLAGS/CXXFLAGS. --- bootstrap | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bootstrap b/bootstrap index 281c3d0dd..afb66e591 100755 --- a/bootstrap +++ b/bootstrap @@ -1525,14 +1525,6 @@ set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man p set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" -# Suppress -isysroot if user-provided flags already have it. -if echo "${cmake_c_flags}" | grep isysroot >/dev/null 2>&1 && - echo "${cmake_cxx_flags}" | grep isysroot >/dev/null 2>&1; then - echo ' -set(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE) -' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" -fi - # Add configuration settings given as command-line options. if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then echo '