diff options
author | Brad King <brad.king@kitware.com> | 2017-06-14 19:10:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-14 19:10:39 (GMT) |
commit | 61c1848cdc88cc5d36b23d14d0721ba832739a58 (patch) | |
tree | 09dc7faf32e207f52368d4ceff8a401e63bce53e /Source/cmGeneratorTarget.cxx | |
parent | df1c187f2fdfa48bd36d770bac23f6503fd9b071 (diff) | |
parent | ba247ccabab05c0aad4fe7f56dd020bfa8ff4583 (diff) | |
download | CMake-61c1848cdc88cc5d36b23d14d0721ba832739a58.zip CMake-61c1848cdc88cc5d36b23d14d0721ba832739a58.tar.gz CMake-61c1848cdc88cc5d36b23d14d0721ba832739a58.tar.bz2 |
Merge branch 'ipo-per-lang' into release-3.9
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 23 |
1 files changed, 15 insertions, 8 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"; |