diff options
author | Brad King <brad.king@kitware.com> | 2019-11-15 14:04:19 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-11-15 14:06:07 (GMT) |
commit | 9bc8854b3c1fe41baa5847f41ff4e4d08c2fda36 (patch) | |
tree | 13d7cb34701edfc47eccc0b2afb01dcda751e6f1 | |
parent | 10f8197400cf0be678444f7400c8739f63096c76 (diff) | |
parent | 6a818b693192e96f57c866caf2541669342a700b (diff) | |
download | CMake-9bc8854b3c1fe41baa5847f41ff4e4d08c2fda36.zip CMake-9bc8854b3c1fe41baa5847f41ff4e4d08c2fda36.tar.gz CMake-9bc8854b3c1fe41baa5847f41ff4e4d08c2fda36.tar.bz2 |
Merge topic 'objc-standard-fix'
6a818b6931 ObjC: Proper initialization of ObjC/XX standard properties
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !4050
-rw-r--r-- | Source/cmLocalGenerator.cxx | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f2bf079..c43876c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -714,21 +714,36 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() // 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))); + if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + auto copyStandardToObjLang = [&](LanguagePair const& lang) -> bool { + if (!target->GetProperty(cmStrCat(lang.first, "_STANDARD"))) { + auto* standard = + target->GetProperty(cmStrCat(lang.second, "_STANDARD")); + if (!standard) { + standard = this->Makefile->GetDefinition( + cmStrCat("CMAKE_", lang.second, "_STANDARD_DEFAULT")); + } + target->Target->SetProperty(cmStrCat(lang.first, "_STANDARD"), + standard); + return true; + } + return false; + }; + auto copyPropertyToObjLang = [&](LanguagePair const& lang, + const char* property) { + if (!target->GetProperty(cmStrCat(lang.first, property)) && + target->GetProperty(cmStrCat(lang.second, property))) { + target->Target->SetProperty( + cmStrCat(lang.first, property), + target->GetProperty(cmStrCat(lang.second, property))); + } + }; + for (auto const& lang : objcEnabledLanguages) { + if (copyStandardToObjLang(lang)) { + copyPropertyToObjLang(lang, "_STANDARD_REQUIRED"); + copyPropertyToObjLang(lang, "_EXTENSIONS"); + } } - }; - for (auto const& lang : objcEnabledLanguages) { - copyPropertyToObjLang(lang, "_STANDARD"); - copyPropertyToObjLang(lang, "_STANDARD_REQUIRED"); - copyPropertyToObjLang(lang, "_EXTENSIONS"); } } |