summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-05-13 17:43:00 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-05-14 15:50:14 (GMT)
commit43640fc80aaff645ba0d2897667cd2b4a85add03 (patch)
treef4c04b62b5f8ee925f106f248e1ada92a3b4af3d
parent7c8c18b1e61ca717941214c2365ce5c5056bad14 (diff)
downloadCMake-43640fc80aaff645ba0d2897667cd2b4a85add03.zip
CMake-43640fc80aaff645ba0d2897667cd2b4a85add03.tar.gz
CMake-43640fc80aaff645ba0d2897667cd2b4a85add03.tar.bz2
Makefiles: Move ADDITIONAL_MAKE_CLEAN_FILES evaluation to lambda
-rw-r--r--Source/cmMakefileTargetGenerator.cxx26
1 files changed, 16 insertions, 10 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2ea6682..2e945ce 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -147,23 +147,29 @@ void cmMakefileTargetGenerator::CreateRuleFile()
void cmMakefileTargetGenerator::WriteTargetBuildRules()
{
+ // -- Write the custom commands for this target
+
const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- // write the custom commands for this target
- // Look for files registered for cleaning in this directory.
- if (const char* additional_clean_files =
- this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
+ // Evaluates generator expressions and expands prop_value
+ auto evaluatedFiles =
+ [this, &config](const char* prop_value) -> std::vector<std::string> {
+ std::vector<std::string> files;
cmGeneratorExpression ge;
- std::unique_ptr<cmCompiledGeneratorExpression> cge =
- ge.Parse(additional_clean_files);
-
- std::vector<std::string> additionalFiles;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value);
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config, false, this->GeneratorTarget,
nullptr, nullptr),
- additionalFiles);
- this->CleanFiles.insert(additionalFiles.begin(), additionalFiles.end());
+ files);
+ return files;
+ };
+
+ // Look for additional files registered for cleaning in this directory.
+ if (const char* prop_value =
+ this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
+ std::vector<std::string> const files = evaluatedFiles(prop_value);
+ this->CleanFiles.insert(files.begin(), files.end());
}
// add custom commands to the clean rules?