mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
Refactoring: s,GetFeatureAsBool,IsIPOEnabled,
Method 'GetFeatureAsBool' is used only with 'INTERPROCEDURAL_OPTIMIZATION' feature. Substituting 'GetFeatureAsBool' with 'IsIPOEnabled'.
This commit is contained in:
committed by
Brad King
parent
e05835c35b
commit
a75757004b
@@ -43,18 +43,13 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature)
|
||||
return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
|
||||
}
|
||||
|
||||
bool cmCommonTargetGenerator::GetFeatureAsBool(const std::string& feature)
|
||||
{
|
||||
return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName);
|
||||
}
|
||||
|
||||
void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags,
|
||||
const std::string& lang)
|
||||
{
|
||||
// Add language-specific flags.
|
||||
this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
|
||||
|
||||
if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) {
|
||||
if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) {
|
||||
this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ protected:
|
||||
|
||||
// Feature query methods.
|
||||
const char* GetFeature(const std::string& feature);
|
||||
bool GetFeatureAsBool(const std::string& feature);
|
||||
|
||||
// Helper to add flag for windows .def file.
|
||||
void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer,
|
||||
|
||||
@@ -656,9 +656,9 @@ const char* cmGeneratorTarget::GetFeature(const std::string& feature,
|
||||
return this->LocalGenerator->GetFeature(feature, config);
|
||||
}
|
||||
|
||||
bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature,
|
||||
const std::string& config) const
|
||||
bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const
|
||||
{
|
||||
const char* feature = "INTERPROCEDURAL_OPTIMIZATION";
|
||||
return cmSystemTools::IsOn(this->GetFeature(feature, config));
|
||||
}
|
||||
|
||||
@@ -2416,7 +2416,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
|
||||
switch (this->GetType()) {
|
||||
case cmStateEnums::STATIC_LIBRARY: {
|
||||
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
|
||||
if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
|
||||
if (this->IsIPOEnabled(config)) {
|
||||
std::string varIPO = var + "_IPO";
|
||||
if (this->Makefile->GetDefinition(varIPO)) {
|
||||
return varIPO;
|
||||
|
||||
@@ -112,8 +112,8 @@ public:
|
||||
|
||||
const char* GetFeature(const std::string& feature,
|
||||
const std::string& config) const;
|
||||
bool GetFeatureAsBool(const std::string& feature,
|
||||
const std::string& config) const;
|
||||
|
||||
bool IsIPOEnabled(const std::string& config) const;
|
||||
|
||||
bool IsLinkInterfaceDependentBoolProperty(const std::string& p,
|
||||
const std::string& config) const;
|
||||
|
||||
@@ -1052,7 +1052,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
|
||||
// Add language-specific flags.
|
||||
this->AddLanguageFlags(flags, lang, config);
|
||||
|
||||
if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
|
||||
if (target->IsIPOEnabled(config)) {
|
||||
this->AppendFeatureOptions(flags, lang, "IPO");
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
|
||||
linkRuleVar += linkLanguage;
|
||||
linkRuleVar += "_CREATE_STATIC_LIBRARY";
|
||||
|
||||
if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") &&
|
||||
if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName) &&
|
||||
this->Makefile->GetDefinition(linkRuleVar + "_IPO")) {
|
||||
linkRuleVar += "_IPO";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user