summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx23
-rw-r--r--Source/cmGeneratorTarget.h5
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx6
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx2
8 files changed, 28 insertions, 20 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index c79e113..b93442d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -469,7 +469,8 @@ const char* cmGeneratorTarget::GetFeature(const std::string& feature,
return this->LocalGenerator->GetFeature(feature, config);
}
-bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const
+bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
+ std::string const& config) const
{
const char* feature = "INTERPROCEDURAL_OPTIMIZATION";
const bool result = cmSystemTools::IsOn(this->GetFeature(feature, config));
@@ -479,10 +480,15 @@ bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const
return false;
}
+ if (lang != "C" && lang != "CXX" && lang != "Fortran") {
+ // We do not define IPO behavior for other languages.
+ return false;
+ }
+
cmPolicies::PolicyStatus cmp0069 = this->GetPolicyStatusCMP0069();
if (cmp0069 == cmPolicies::OLD || cmp0069 == cmPolicies::WARN) {
- if (this->Makefile->IsOn("_CMAKE_IPO_LEGACY_BEHAVIOR")) {
+ if (this->Makefile->IsOn("_CMAKE_" + lang + "_IPO_LEGACY_BEHAVIOR")) {
return true;
}
if (this->PolicyReportedCMP0069) {
@@ -506,10 +512,10 @@ bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const
// Note: check consistency with messages from CheckIPOSupported
const char* message = CM_NULLPTR;
- if (!this->Makefile->IsOn("_CMAKE_IPO_SUPPORTED_BY_CMAKE")) {
+ if (!this->Makefile->IsOn("_CMAKE_" + lang + "_IPO_SUPPORTED_BY_CMAKE")) {
message = "CMake doesn't support IPO for current compiler";
- } else if (!this->Makefile->IsOn(
- "_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER")) {
+ } else if (!this->Makefile->IsOn("_CMAKE_" + lang +
+ "_IPO_MAY_BE_SUPPORTED_BY_COMPILER")) {
message = "Compiler doesn't support IPO";
} else if (!this->GlobalGenerator->IsIPOSupported()) {
message = "CMake doesn't support IPO for current generator";
@@ -2417,9 +2423,10 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable(
- std::string const& var, std::string const& config) const
+ std::string const& var, std::string const& lang,
+ std::string const& config) const
{
- if (this->IsIPOEnabled(config)) {
+ if (this->IsIPOEnabled(lang, config)) {
std::string varIPO = var + "_IPO";
if (this->Makefile->IsDefinitionSet(varIPO)) {
return varIPO;
@@ -2436,7 +2443,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
switch (this->GetType()) {
case cmStateEnums::STATIC_LIBRARY: {
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
- return this->GetFeatureSpecificLinkRuleVariable(var, config);
+ return this->GetFeatureSpecificLinkRuleVariable(var, lang, config);
}
case cmStateEnums::SHARED_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 134b7c7..c04d62b 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -165,7 +165,7 @@ public:
const char* GetFeature(const std::string& feature,
const std::string& config) const;
- bool IsIPOEnabled(const std::string& config) const;
+ bool IsIPOEnabled(std::string const& lang, std::string const& config) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string& p,
const std::string& config) const;
@@ -385,7 +385,8 @@ public:
std::vector<std::string>& archVec) const;
std::string GetFeatureSpecificLinkRuleVariable(
- std::string const& var, std::string const& config) const;
+ std::string const& var, std::string const& lang,
+ std::string const& config) const;
/** Return the rule variable used to create this type of target. */
std::string GetCreateRuleVariable(std::string const& lang,
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 64616ad..45c1764 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1666,7 +1666,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
return;
}
- if (gtgt->IsIPOEnabled(configName)) {
+ if (gtgt->IsIPOEnabled(llang, configName)) {
const char* ltoValue =
this->CurrentMakefile->IsOn("_CMAKE_LTO_THIN") ? "YES_THIN" : "YES";
buildSettings->AddAttribute("LLVM_LTO", this->CreateString(ltoValue));
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index bc886b6..8e00303 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1334,7 +1334,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
flagsVar += "_FLAGS";
this->AddConfigVariableFlags(flags, flagsVar, config);
- if (target->IsIPOEnabled(config)) {
+ if (target->IsIPOEnabled(lang, config)) {
this->AppendFeatureOptions(flags, lang, "IPO");
}
}
@@ -1836,7 +1836,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
const std::string& config,
const std::string& lang)
{
- if (!target->IsIPOEnabled(config)) {
+ if (!target->IsIPOEnabled(lang, config)) {
return;
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index f86c034..dd08e5b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -672,7 +672,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
this->AddCompileOptions(flags, target, linkLanguage, configName);
// Check IPO related warning/error.
- target->IsIPOEnabled(configName);
+ target->IsIPOEnabled(linkLanguage, configName);
}
if (this->FortranProject) {
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2b37b4d..3d1594b 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -699,7 +699,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arCreateVar += "_ARCHIVE_CREATE";
arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- arCreateVar, this->ConfigName);
+ arCreateVar, linkLanguage, this->ConfigName);
if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) {
cmSystemTools::ExpandListArgument(rule, archiveCreateCommands);
@@ -709,7 +709,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arAppendVar += "_ARCHIVE_APPEND";
arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- arAppendVar, this->ConfigName);
+ arAppendVar, linkLanguage, this->ConfigName);
if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) {
cmSystemTools::ExpandListArgument(rule, archiveAppendCommands);
@@ -719,7 +719,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arFinishVar += "_ARCHIVE_FINISH";
arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- arFinishVar, this->ConfigName);
+ arFinishVar, linkLanguage, this->ConfigName);
if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) {
cmSystemTools::ExpandListArgument(rule, archiveFinishCommands);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 0331828..14a4ef8 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -512,7 +512,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
linkCmdVar += "_ARCHIVE_CREATE";
linkCmdVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- linkCmdVar, this->GetConfigName());
+ linkCmdVar, this->TargetLinkLanguage, this->GetConfigName());
const char* linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
@@ -523,7 +523,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
linkCmdVar += "_ARCHIVE_FINISH";
linkCmdVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- linkCmdVar, this->GetConfigName());
+ linkCmdVar, this->TargetLinkLanguage, this->GetConfigName());
const char* linkCmd = mf->GetRequiredDefinition(linkCmdVar);
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b644405..d9b81a3 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2285,7 +2285,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
// Check IPO related warning/error.
- this->GeneratorTarget->IsIPOEnabled(configName);
+ this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName);
// Get preprocessor definitions for this directory.
std::string defineFlags =