Commit 6fdba8b8 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'refactor-lang-flags'

70728398 VS: Use AddLanguageFlags to de-duplicate CMAKE_<LANG>_FLAGS* lookup
8ca1b262

 cmLocalGenerator: Factor IPO logic out of AddLanguageFlags
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !3177
parents 05821766 70728398
Pipeline #133886 passed with stage
in 0 seconds
......@@ -1800,6 +1800,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang,
configName);
if (gtgt->IsIPOEnabled(lang, configName)) {
this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
}
// Add shared-library flags if needed.
this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang,
configName);
......
......@@ -1258,6 +1258,10 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
// Add language-specific flags.
this->AddLanguageFlags(flags, target, lang, config);
if (target->IsIPOEnabled(lang, config)) {
this->AppendFeatureOptions(flags, lang, "IPO");
}
this->AddArchitectureFlags(flags, target, lang, config);
if (lang == "Fortran") {
......@@ -1515,9 +1519,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
flagsVar += "_FLAGS";
this->AddConfigVariableFlags(flags, flagsVar, config);
if (target->IsIPOEnabled(lang, config)) {
this->AppendFeatureOptions(flags, lang, "IPO");
}
// Placeholder for possible future per-target flags.
static_cast<void>(target);
}
void cmLocalGenerator::AddLanguageFlagsForLinking(
......@@ -1534,6 +1537,10 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
}
this->AddLanguageFlags(flags, target, lang, config);
if (target->IsIPOEnabled(lang, config)) {
this->AppendFeatureOptions(flags, lang, "IPO");
}
}
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
......
......@@ -662,14 +662,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
langForClCompile = linkLanguage;
if (langForClCompile == "C" || langForClCompile == "CXX" ||
langForClCompile == "Fortran") {
std::string baseFlagVar = "CMAKE_";
baseFlagVar += langForClCompile;
baseFlagVar += "_FLAGS";
flags = this->Makefile->GetRequiredDefinition(baseFlagVar);
std::string flagVar =
baseFlagVar + std::string("_") + cmSystemTools::UpperCase(configName);
flags += " ";
flags += this->Makefile->GetRequiredDefinition(flagVar);
this->AddLanguageFlags(flags, target, langForClCompile, configName);
}
// set the correct language
if (linkLanguage == "C") {
......
......@@ -2540,14 +2540,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
this->LangForClCompile = langForClCompile;
if (!langForClCompile.empty()) {
std::string baseFlagVar = "CMAKE_";
baseFlagVar += langForClCompile;
baseFlagVar += "_FLAGS";
flags = this->Makefile->GetRequiredDefinition(baseFlagVar);
std::string flagVar =
baseFlagVar + "_" + cmSystemTools::UpperCase(configName);
flags += " ";
flags += this->Makefile->GetRequiredDefinition(flagVar);
this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
langForClCompile, configName);
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
langForClCompile, configName);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment