Merge topic 'move-Feature-API'
f573bd22
cmLocalGenerator: Add Feature API from cmMakefile.ccbc2259
cmGeneratorTarget: Move Feature API from cmTarget.
This commit is contained in:
commit
f5690cc57c
|
@ -352,6 +352,34 @@ void cmGeneratorTarget::ComputeObjectMapping()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
const char* cmGeneratorTarget::GetFeature(const std::string& feature,
|
||||||
|
const std::string& config) const
|
||||||
|
{
|
||||||
|
if(!config.empty())
|
||||||
|
{
|
||||||
|
std::string featureConfig = feature;
|
||||||
|
featureConfig += "_";
|
||||||
|
featureConfig += cmSystemTools::UpperCase(config);
|
||||||
|
if(const char* value = this->Target->GetProperty(featureConfig))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(const char* value = this->Target->GetProperty(feature))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return this->LocalGenerator->GetFeature(feature, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature,
|
||||||
|
const std::string& config) const
|
||||||
|
{
|
||||||
|
return cmSystemTools::IsOn(this->GetFeature(feature, config));
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
|
const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
|
||||||
{
|
{
|
||||||
|
@ -983,7 +1011,7 @@ cmGeneratorTarget::GetCreateRuleVariable(std::string const& lang,
|
||||||
case cmTarget::STATIC_LIBRARY:
|
case cmTarget::STATIC_LIBRARY:
|
||||||
{
|
{
|
||||||
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
|
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
|
||||||
if(this->Target->GetFeatureAsBool(
|
if(this->GetFeatureAsBool(
|
||||||
"INTERPROCEDURAL_OPTIMIZATION", config))
|
"INTERPROCEDURAL_OPTIMIZATION", config))
|
||||||
{
|
{
|
||||||
std::string varIPO = var + "_IPO";
|
std::string varIPO = var + "_IPO";
|
||||||
|
|
|
@ -67,6 +67,11 @@ public:
|
||||||
|
|
||||||
void ComputeObjectMapping();
|
void ComputeObjectMapping();
|
||||||
|
|
||||||
|
const char* GetFeature(const std::string& feature,
|
||||||
|
const std::string& config) const;
|
||||||
|
bool GetFeatureAsBool(const std::string& feature,
|
||||||
|
const std::string& config) const;
|
||||||
|
|
||||||
cmTarget* Target;
|
cmTarget* Target;
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmLocalGenerator* LocalGenerator;
|
cmLocalGenerator* LocalGenerator;
|
||||||
|
|
|
@ -1025,12 +1025,13 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||||
{
|
{
|
||||||
return activeConfigs;
|
return activeConfigs;
|
||||||
}
|
}
|
||||||
|
cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
|
||||||
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
|
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
|
||||||
for(std::vector<std::string>::const_iterator i = configs.begin();
|
for(std::vector<std::string>::const_iterator i = configs.begin();
|
||||||
i != configs.end(); ++i)
|
i != configs.end(); ++i)
|
||||||
{
|
{
|
||||||
const char* propertyValue =
|
const char* propertyValue =
|
||||||
target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
|
gt->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
|
||||||
if(cmSystemTools::IsOff(propertyValue))
|
if(cmSystemTools::IsOff(propertyValue))
|
||||||
{
|
{
|
||||||
activeConfigs.insert(*i);
|
activeConfigs.insert(*i);
|
||||||
|
|
|
@ -2519,6 +2519,33 @@ void cmLocalGenerator::AppendFeatureOptions(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
const char* cmLocalGenerator::GetFeature(const std::string& feature,
|
||||||
|
const std::string& config)
|
||||||
|
{
|
||||||
|
// TODO: Define accumulation policy for features (prepend, append, replace).
|
||||||
|
// Currently we always replace.
|
||||||
|
if(!config.empty())
|
||||||
|
{
|
||||||
|
std::string featureConfig = feature;
|
||||||
|
featureConfig += "_";
|
||||||
|
featureConfig += cmSystemTools::UpperCase(config);
|
||||||
|
if(const char* value = this->Makefile->GetProperty(featureConfig))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(const char* value = this->Makefile->GetProperty(feature))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if(cmLocalGenerator* parent = this->GetParent())
|
||||||
|
{
|
||||||
|
return parent->GetFeature(feature, config);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
|
cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
|
||||||
|
|
|
@ -151,6 +151,9 @@ public:
|
||||||
void AppendFeatureOptions(std::string& flags, const std::string& lang,
|
void AppendFeatureOptions(std::string& flags, const std::string& lang,
|
||||||
const char* feature);
|
const char* feature);
|
||||||
|
|
||||||
|
const char* GetFeature(const std::string& feature,
|
||||||
|
const std::string& config);
|
||||||
|
|
||||||
/** \brief Get absolute path to dependency \a name
|
/** \brief Get absolute path to dependency \a name
|
||||||
*
|
*
|
||||||
* Translate a dependency as given in CMake code to the name to
|
* Translate a dependency as given in CMake code to the name to
|
||||||
|
|
|
@ -4215,33 +4215,6 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
|
||||||
return cmSystemTools::IsOn(this->GetProperty(prop));
|
return cmSystemTools::IsOn(this->GetProperty(prop));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
const char* cmMakefile::GetFeature(const std::string& feature,
|
|
||||||
const std::string& config)
|
|
||||||
{
|
|
||||||
// TODO: Define accumulation policy for features (prepend, append, replace).
|
|
||||||
// Currently we always replace.
|
|
||||||
if(!config.empty())
|
|
||||||
{
|
|
||||||
std::string featureConfig = feature;
|
|
||||||
featureConfig += "_";
|
|
||||||
featureConfig += cmSystemTools::UpperCase(config);
|
|
||||||
if(const char* value = this->GetProperty(featureConfig))
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(const char* value = this->GetProperty(feature))
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
if(cmLocalGenerator* parent = this->LocalGenerator->GetParent())
|
|
||||||
{
|
|
||||||
return parent->GetMakefile()->GetFeature(feature, config);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmTarget* cmMakefile::FindTarget(const std::string& name,
|
cmTarget* cmMakefile::FindTarget(const std::string& name,
|
||||||
bool excludeAliases) const
|
bool excludeAliases) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -727,9 +727,6 @@ public:
|
||||||
cmProperty::ScopeType scope) const;
|
cmProperty::ScopeType scope) const;
|
||||||
bool GetPropertyAsBool(const std::string& prop) const;
|
bool GetPropertyAsBool(const std::string& prop) const;
|
||||||
|
|
||||||
const char* GetFeature(const std::string& feature,
|
|
||||||
const std::string& config);
|
|
||||||
|
|
||||||
// Get the properties
|
// Get the properties
|
||||||
cmPropertyMap &GetProperties() { return this->Properties; }
|
cmPropertyMap &GetProperties() { return this->Properties; }
|
||||||
|
|
||||||
|
|
|
@ -2086,13 +2086,13 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature)
|
const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature)
|
||||||
{
|
{
|
||||||
return this->Target->GetFeature(feature, this->ConfigName);
|
return this->GeneratorTarget->GetFeature(feature, this->ConfigName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature)
|
bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature)
|
||||||
{
|
{
|
||||||
return this->Target->GetFeatureAsBool(feature, this->ConfigName);
|
return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -107,13 +107,14 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule(
|
||||||
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
|
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
|
||||||
const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature)
|
const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature)
|
||||||
{
|
{
|
||||||
return this->Target->GetFeature(feature, this->GetConfigName());
|
return this->GeneratorTarget->GetFeature(feature, this->GetConfigName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
|
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
|
||||||
bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature)
|
bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature)
|
||||||
{
|
{
|
||||||
return this->Target->GetFeatureAsBool(feature, this->GetConfigName());
|
return this->GeneratorTarget->GetFeatureAsBool(feature,
|
||||||
|
this->GetConfigName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
|
// TODO: Picked up from cmMakefileTargetGenerator. Refactor it.
|
||||||
|
|
|
@ -2813,34 +2813,6 @@ void cmTarget::GetTargetVersion(bool soversion,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
const char* cmTarget::GetFeature(const std::string& feature,
|
|
||||||
const std::string& config) const
|
|
||||||
{
|
|
||||||
if(!config.empty())
|
|
||||||
{
|
|
||||||
std::string featureConfig = feature;
|
|
||||||
featureConfig += "_";
|
|
||||||
featureConfig += cmSystemTools::UpperCase(config);
|
|
||||||
if(const char* value = this->GetProperty(featureConfig))
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(const char* value = this->GetProperty(feature))
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return this->Makefile->GetFeature(feature, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool cmTarget::GetFeatureAsBool(const std::string& feature,
|
|
||||||
const std::string& config) const
|
|
||||||
{
|
|
||||||
return cmSystemTools::IsOn(this->GetFeature(feature, config));
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
|
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,11 +260,6 @@ public:
|
||||||
bool GetPropertyAsBool(const std::string& prop) const;
|
bool GetPropertyAsBool(const std::string& prop) const;
|
||||||
void CheckProperty(const std::string& prop, cmMakefile* context) const;
|
void CheckProperty(const std::string& prop, cmMakefile* context) const;
|
||||||
|
|
||||||
const char* GetFeature(const std::string& feature,
|
|
||||||
const std::string& config) const;
|
|
||||||
bool GetFeatureAsBool(const std::string& feature,
|
|
||||||
const std::string& config) const;
|
|
||||||
|
|
||||||
bool IsImported() const {return this->IsImportedTarget;}
|
bool IsImported() const {return this->IsImportedTarget;}
|
||||||
|
|
||||||
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
|
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
|
||||||
|
|
Loading…
Reference in New Issue