cmLocalGenerator: Add Feature API from cmMakefile.
This commit is contained in:
parent
ccbc225913
commit
f573bd22e4
|
@ -370,7 +370,7 @@ const char* cmGeneratorTarget::GetFeature(const std::string& feature,
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return this->Makefile->GetFeature(feature, config);
|
return this->LocalGenerator->GetFeature(feature, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -2572,6 +2572,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,
|
||||||
|
|
|
@ -179,6 +179,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; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue