diff options
author | Brad King <brad.king@kitware.com> | 2019-11-13 14:38:31 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-11-13 14:40:47 (GMT) |
commit | 4909594abdb768b89c7fb30d0693df7f05c54465 (patch) | |
tree | 77caa3f9470bee6f54c31a571f6f136010b9bd71 | |
parent | c104c3eec2184426b4e83420d25be207cdec90f5 (diff) | |
parent | 81566557d591bf375384ca3e697877ba67c2f77d (diff) | |
download | CMake-4909594abdb768b89c7fb30d0693df7f05c54465.zip CMake-4909594abdb768b89c7fb30d0693df7f05c54465.tar.gz CMake-4909594abdb768b89c7fb30d0693df7f05c54465.tar.bz2 |
Merge topic 'objc-standard'
81566557d5 ObjC: Initialize ObjC/XX standard properties from C/C++ counterparts
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4022
-rw-r--r-- | Source/cmLocalGenerator.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f8d4318..f2bf079 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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 auto& targets = this->GetGeneratorTargets(); for (const auto& 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; |