mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 05:10:10 -05:00
Implement interprocedural optimization for GNU compilers
Honor the `INTERPROCEDURAL_OPTIMIZATION` target property for GNU compilers by activating their link-time-optimization (LTO) flags.
This commit is contained in:
committed by
Brad King
parent
1588a577d1
commit
dfa8263f4b
@@ -2466,19 +2466,28 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable(
|
||||
std::string const& var, std::string const& config) const
|
||||
{
|
||||
if (this->IsIPOEnabled(config)) {
|
||||
std::string varIPO = var + "_IPO";
|
||||
if (this->Makefile->IsDefinitionSet(varIPO)) {
|
||||
return varIPO;
|
||||
}
|
||||
}
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string cmGeneratorTarget::GetCreateRuleVariable(
|
||||
std::string const& lang, std::string const& config) const
|
||||
{
|
||||
switch (this->GetType()) {
|
||||
case cmStateEnums::STATIC_LIBRARY: {
|
||||
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
|
||||
if (this->IsIPOEnabled(config)) {
|
||||
std::string varIPO = var + "_IPO";
|
||||
if (this->Makefile->GetDefinition(varIPO)) {
|
||||
return varIPO;
|
||||
}
|
||||
}
|
||||
return var;
|
||||
return this->GetFeatureSpecificLinkRuleVariable(var, config);
|
||||
}
|
||||
case cmStateEnums::SHARED_LIBRARY:
|
||||
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
|
||||
|
||||
Reference in New Issue
Block a user