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.
This commit is contained in:
Brad King 2014-04-29 09:21:00 -04:00
parent 0200d0a9c4
commit 0cce556b5f
2 changed files with 13 additions and 0 deletions

View File

@ -215,6 +215,17 @@ Id flags: ${testflags}
else() else()
set(id_toolset "") set(id_toolset "")
endif() 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) if(NOT ${XCODE_VERSION} VERSION_LESS 3)
set(v 3) set(v 3)
set(ext xcodeproj) set(ext xcodeproj)

View File

@ -84,6 +84,8 @@
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
SYMROOT = .; SYMROOT = .;
@id_toolset@ @id_toolset@
@id_deployment_target@
@id_sdkroot@
}; };
name = Debug; name = Debug;
}; };