Commit 786954c4 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'objc-standard' into release-3.16

81566557 ObjC: Initialize ObjC/XX standard properties from C/C++ counterparts
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !4022
parents a0212382 81566557
......@@ -693,6 +693,16 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures()
configNames.emplace_back();
}
using LanguagePair = std::pair<std::string, std::string>;
std::vector<LanguagePair> pairedLanguages{ { "OBJC", "C" },
{ "OBJCXX", "CXX" } };
std::set<LanguagePair> objcEnabledLanguages;
for (auto const& lang : pairedLanguages) {
if (this->Makefile->GetState()->GetLanguageEnabled(lang.first)) {
objcEnabledLanguages.insert(lang);
}
}
// Process compile features of all targets.
const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets();
for (cmGeneratorTarget* target : targets) {
......@@ -701,6 +711,25 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures()
return false;
}
}
// Now that C/C++ _STANDARD values have been computed
// set the values to ObjC/ObjCXX _STANDARD variables
auto copyPropertyToObjLang = [&](LanguagePair const& lang,
const char* property) {
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
if (!target->GetProperty(cmStrCat(lang.first, property))) {
target->Target->SetProperty(
cmStrCat(lang.first, property),
target->GetProperty(cmStrCat(lang.second, property)));
}
};
for (auto const& lang : objcEnabledLanguages) {
copyPropertyToObjLang(lang, "_STANDARD");
copyPropertyToObjLang(lang, "_STANDARD_REQUIRED");
copyPropertyToObjLang(lang, "_EXTENSIONS");
}
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment