diff options
author | Brad King <brad.king@kitware.com> | 2015-08-27 14:04:05 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-08-27 14:04:05 (GMT) |
commit | a97bb6ae3f70febd207ef2373287237249f082e5 (patch) | |
tree | 2c3ebb17e971ff41aadbb4e323a8cc6fb8c6160d | |
parent | 2985b9c00348c81d3cba9603e50a22da4e54cefa (diff) | |
parent | e3078aa15328439e239b2beb4085dc644ec465ec (diff) | |
download | CMake-a97bb6ae3f70febd207ef2373287237249f082e5.zip CMake-a97bb6ae3f70febd207ef2373287237249f082e5.tar.gz CMake-a97bb6ae3f70febd207ef2373287237249f082e5.tar.bz2 |
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.
-rw-r--r-- | Source/cmLocalGenerator.cxx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index edb644d..c2d1a7d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2368,25 +2368,22 @@ void cmLocalGenerator::AppendFeatureOptions( const char* cmLocalGenerator::GetFeature(const std::string& feature, const std::string& config) { + std::string featureName = feature; // 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)) + featureName += "_"; + featureName += cmSystemTools::UpperCase(config); + } + cmState::Snapshot snp = this->StateSnapshot; + while(snp.IsValid()) + { + if(const char* value = snp.GetDirectory().GetProperty(featureName)) { return value; } - } - if(const char* value = this->Makefile->GetProperty(feature)) - { - return value; - } - if(cmLocalGenerator* parent = this->GetParent()) - { - return parent->GetFeature(feature, config); + snp = snp.GetBuildsystemDirectoryParent(); } return 0; } |