summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-27 20:15:07 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-27 20:15:07 (GMT)
commita8667467ea6337faddb0eeb7a8d0b08154338ac0 (patch)
tree85b8b490943289ed6b55fd835c6ec0565156e9c8
parentf0ae821681a0a0b4f411a0feb4a6f6e458475999 (diff)
downloadCMake-a8667467ea6337faddb0eeb7a8d0b08154338ac0.zip
CMake-a8667467ea6337faddb0eeb7a8d0b08154338ac0.tar.gz
CMake-a8667467ea6337faddb0eeb7a8d0b08154338ac0.tar.bz2
Add IPO compiler flags more consistently in generators
Move addition of IPO flags into `cmLocalGenerator::AddLanguageFlags` because all call sites of that need the IPO flags, but not all were following the call with `AppendFeatureOptions`.
-rw-r--r--Source/cmCommonTargetGenerator.cxx7
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx8
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx3
-rw-r--r--Source/cmLocalGenerator.cxx13
-rw-r--r--Source/cmLocalGenerator.h4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx4
6 files changed, 20 insertions, 19 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 178a7ce..8114020 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -47,11 +47,8 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
const std::string& lang)
{
// Add language-specific flags.
- this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
-
- if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) {
- this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
- }
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, lang,
+ this->ConfigName);
}
void cmCommonTargetGenerator::AddModuleDefinitionFlag(
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index ba623d5..7032cd5 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -232,10 +232,12 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
const char* lang = language.c_str();
if (notKernel) {
- this->LocalGenerator->AddLanguageFlags(flags, lang, config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ lang, config);
} else {
- this->LocalGenerator->AddLanguageFlags(
- flags, lang + std::string("_GHS_KERNEL"), config);
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ lang + std::string("_GHS_KERNEL"),
+ config);
}
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
config);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6636329..d99e3bb 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1662,7 +1662,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string& flags = cflags[lang];
// Add language-specific flags.
- this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
+ this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang,
+ configName);
// Add shared-library flags if needed.
this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang,
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 424ab6f..57b744c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -985,7 +985,7 @@ void cmLocalGenerator::GetTargetFlags(
target->GetName().c_str());
return;
}
- this->AddLanguageFlags(flags, linkLanguage, buildType);
+ this->AddLanguageFlags(flags, target, linkLanguage, buildType);
if (pcli) {
this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
frameworkPath, linkPath);
@@ -1050,11 +1050,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
cmMakefile* mf = this->GetMakefile();
// Add language-specific flags.
- this->AddLanguageFlags(flags, lang, config);
-
- if (target->IsIPOEnabled(config)) {
- this->AppendFeatureOptions(flags, lang, "IPO");
- }
+ this->AddLanguageFlags(flags, target, lang, config);
this->AddArchitectureFlags(flags, target, lang, config);
@@ -1287,6 +1283,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
+ cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config)
{
@@ -1295,6 +1292,10 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
flagsVar += lang;
flagsVar += "_FLAGS";
this->AddConfigVariableFlags(flags, flagsVar, config);
+
+ if (target->IsIPOEnabled(config)) {
+ this->AppendFeatureOptions(flags, lang, "IPO");
+ }
}
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1459a05..2eda0e5 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -98,8 +98,8 @@ public:
const std::string& lang,
const std::string& config);
- void AddLanguageFlags(std::string& flags, const std::string& lang,
- const std::string& config);
+ void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target,
+ const std::string& lang, const std::string& config);
void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target,
std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string& flags,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 8206083..54ae196 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -655,7 +655,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName);
vars["ARCH_FLAGS"] = t;
t = "";
- localGen.AddLanguageFlags(t, cudaLinkLanguage, cfgName);
+ localGen.AddLanguageFlags(t, &genTarget, cudaLinkLanguage, cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {
@@ -874,7 +874,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["ARCH_FLAGS"] = t;
t = "";
t += lwyuFlags;
- localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName);
+ localGen.AddLanguageFlags(t, &genTarget, TargetLinkLanguage, cfgName);
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (this->GetGeneratorTarget()->HasSOName(cfgName)) {