diff options
author | Brad King <brad.king@kitware.com> | 2022-11-17 15:39:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-11-18 16:44:52 (GMT) |
commit | a1c20b08b4b1b913a205607dad7240d5c63f4a62 (patch) | |
tree | fd8d1130b8a384e3cffd21a1356a7f6af207f964 /Source/cmLocalGenerator.cxx | |
parent | 914571a04249ee561a30309197d8e1c1cacbe18b (diff) | |
download | CMake-a1c20b08b4b1b913a205607dad7240d5c63f4a62.zip CMake-a1c20b08b4b1b913a205607dad7240d5c63f4a62.tar.gz CMake-a1c20b08b4b1b913a205607dad7240d5c63f4a62.tar.bz2 |
cmLocalGenerator: Inline AddCompilerRequirementFlag in only call site
The call site in `AddLanguageFlags` is now the "one true place" for
adding language standard flags. Inline the helper to reduce risk of
adding other call sites later.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 550141f..4d5371f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1935,7 +1935,19 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, // selection, this will have to be reconciled with it. this->Makefile->IsOn( cmStrCat("CMAKE_", lang, "_LINK_WITH_STANDARD_COMPILE_OPTION")))) { - this->AddCompilerRequirementFlag(flags, target, lang, config); + cmStandardLevelResolver standardResolver(this->Makefile); + std::string const& optionFlagDef = + standardResolver.GetCompileOptionDef(target, lang, config); + if (!optionFlagDef.empty()) { + cmValue opt = + target->Target->GetMakefile()->GetDefinition(optionFlagDef); + if (opt) { + std::vector<std::string> optVec = cmExpandedList(*opt); + for (std::string const& i : optVec) { + this->AppendFlagEscape(flags, i); + } + } + } } std::string compiler = this->Makefile->GetSafeDefinition( @@ -2221,25 +2233,6 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, } } -void cmLocalGenerator::AddCompilerRequirementFlag( - std::string& flags, cmGeneratorTarget const* target, const std::string& lang, - const std::string& config) -{ - cmStandardLevelResolver standardResolver(this->Makefile); - - std::string const& optionFlagDef = - standardResolver.GetCompileOptionDef(target, lang, config); - if (!optionFlagDef.empty()) { - cmValue opt = target->Target->GetMakefile()->GetDefinition(optionFlagDef); - if (opt) { - std::vector<std::string> optVec = cmExpandedList(*opt); - for (std::string const& i : optVec) { - this->AppendFlagEscape(flags, i); - } - } - } -} - static void AddVisibilityCompileOption(std::string& flags, cmGeneratorTarget const* target, cmLocalGenerator* lg, |