Darwin: Emit deployment target that matches the SDK

Closes: #17431
This commit is contained in:
Gregor Jasny
2017-11-04 15:27:48 +01:00
parent 8f4663ffb2
commit 4017bf40de
15 changed files with 185 additions and 15 deletions
+22 -1
View File
@@ -2992,7 +2992,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
buildSettings->AddAttribute("ARCHS", this->CreateString(archs));
}
if (deploymentTarget && *deploymentTarget) {
buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET",
buildSettings->AddAttribute(GetDeploymentPlatform(root->GetMakefile()),
this->CreateString(deploymentTarget));
}
if (!this->GeneratorToolset.empty()) {
@@ -3627,3 +3627,24 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
dir += "/";
gt->ObjectDirectory = dir;
}
std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(const cmMakefile* mf)
{
switch (mf->GetAppleSDKType()) {
case cmMakefile::AppleSDK::AppleTVOS:
case cmMakefile::AppleSDK::AppleTVSimulator:
return "TVOS_DEPLOYMENT_TARGET";
case cmMakefile::AppleSDK::IPhoneOS:
case cmMakefile::AppleSDK::IPhoneSimulator:
return "IPHONEOS_DEPLOYMENT_TARGET";
case cmMakefile::AppleSDK::WatchOS:
case cmMakefile::AppleSDK::WatchSimulator:
return "WATCHOS_DEPLOYMENT_TARGET";
case cmMakefile::AppleSDK::MacOS:
default:
return "MACOSX_DEPLOYMENT_TARGET";
}
}