From 0cce556b5fbe629dccee294aeece7c275343ed64 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 29 Apr 2014 09:21:00 -0400 Subject: Xcode: Use sysroot and deployment target to identify compiler Use CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET to set the Xcode SDKROOT and MACOSX_DEPLOYMENT_TARGET build settings. This is necessary because some versions of Xcode select a different compiler based on these settings. We need to make sure the compiler identified during language initialization matches what will be used for the actual build. --- Modules/CMakeDetermineCompilerId.cmake | 11 +++++++++++ Modules/CompilerId/Xcode-3.pbxproj.in | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 067892d..9a256d5 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -215,6 +215,17 @@ Id flags: ${testflags} else() set(id_toolset "") endif() + if(CMAKE_OSX_DEPLOYMENT_TARGET) + set(id_deployment_target + "MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";") + else() + set(id_deployment_target "") + endif() + if(CMAKE_OSX_SYSROOT) + set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";") + else() + set(id_sdkroot "") + endif() if(NOT ${XCODE_VERSION} VERSION_LESS 3) set(v 3) set(ext xcodeproj) diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index 6f861eb..eabfc6b 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -84,6 +84,8 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; SYMROOT = .; @id_toolset@ + @id_deployment_target@ + @id_sdkroot@ }; name = Debug; }; -- cgit v0.12