Merge topic 'refactor-features'
e3078aa1
cmLocalGenerator: Implement GetFeature in terms of cmState.7441fde3
cmLocalGenerator: Convert GetFeature recursion to loop.ad0b0089
cmLocalGenerator: Simplify GetFeature implementation.314c9ae3
cmLocalGenerator: Make GetFeature tail-recursive.
This commit is contained in:
commit
a97bb6ae3f
|
@ -2368,25 +2368,22 @@ void cmLocalGenerator::AppendFeatureOptions(
|
||||||
const char* cmLocalGenerator::GetFeature(const std::string& feature,
|
const char* cmLocalGenerator::GetFeature(const std::string& feature,
|
||||||
const std::string& config)
|
const std::string& config)
|
||||||
{
|
{
|
||||||
|
std::string featureName = feature;
|
||||||
// TODO: Define accumulation policy for features (prepend, append, replace).
|
// TODO: Define accumulation policy for features (prepend, append, replace).
|
||||||
// Currently we always replace.
|
// Currently we always replace.
|
||||||
if(!config.empty())
|
if(!config.empty())
|
||||||
{
|
{
|
||||||
std::string featureConfig = feature;
|
featureName += "_";
|
||||||
featureConfig += "_";
|
featureName += cmSystemTools::UpperCase(config);
|
||||||
featureConfig += cmSystemTools::UpperCase(config);
|
}
|
||||||
if(const char* value = this->Makefile->GetProperty(featureConfig))
|
cmState::Snapshot snp = this->StateSnapshot;
|
||||||
|
while(snp.IsValid())
|
||||||
|
{
|
||||||
|
if(const char* value = snp.GetDirectory().GetProperty(featureName))
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
snp = snp.GetBuildsystemDirectoryParent();
|
||||||
if(const char* value = this->Makefile->GetProperty(feature))
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
if(cmLocalGenerator* parent = this->GetParent())
|
|
||||||
{
|
|
||||||
return parent->GetFeature(feature, config);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue