summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-15 14:04:19 +0000
committerKitware Robot <kwrobot@kitware.com>2019-11-15 09:06:07 -0500
commitf8a1b07953e6bf40da7def8459f8327cb007d2a9 (patch)
tree8c787f3acf95cb396fad05fa1f86b57a4bade30d
parent330b7b01909e5a6fda0b6fc89f2775953cf6cdc8 (diff)
parent6a818b693192e96f57c866caf2541669342a700b (diff)
downloadcmake-f8a1b07953e6bf40da7def8459f8327cb007d2a9.tar.gz
Merge topic 'objc-standard-fix' into release-3.16
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.cxx43
1 files changed, 29 insertions, 14 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5f8b92089a..923d2a5df3 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");
}
}