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.
This commit is contained in:
parent
914571a042
commit
a1c20b08b4
@ -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,
|
||||
|
@ -164,10 +164,6 @@ public:
|
||||
const std::string& lang);
|
||||
void AddConfigVariableFlags(std::string& flags, const std::string& var,
|
||||
const std::string& config);
|
||||
void AddCompilerRequirementFlag(std::string& flags,
|
||||
cmGeneratorTarget const* target,
|
||||
const std::string& lang,
|
||||
const std::string& config);
|
||||
void AddColorDiagnosticsFlags(std::string& flags, const std::string& lang);
|
||||
//! Append flags to a string.
|
||||
virtual void AppendFlags(std::string& flags,
|
||||
|
Loading…
Reference in New Issue
Block a user