From 43640fc80aaff645ba0d2897667cd2b4a85add03 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 13 May 2019 19:43:00 +0200 Subject: Makefiles: Move ADDITIONAL_MAKE_CLEAN_FILES evaluation to lambda --- Source/cmMakefileTargetGenerator.cxx | 26 ++++++++++++++++---------- 1 file 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::vector files; cmGeneratorExpression ge; - std::unique_ptr cge = - ge.Parse(additional_clean_files); - - std::vector additionalFiles; + std::unique_ptr 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 const files = evaluatedFiles(prop_value); + this->CleanFiles.insert(files.begin(), files.end()); } // add custom commands to the clean rules? -- cgit v0.12