From 844779bdc1cf124974d946d7a221407dd4d3f693 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Sep 2020 13:53:34 -0400 Subject: cmMakefileTargetGenerator: Simplify custom command output collection --- Source/cmMakefileTargetGenerator.cxx | 13 +++---------- Source/cmMakefileTargetGenerator.h | 3 +++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ebfddb9..bc0725e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1290,16 +1290,7 @@ void cmMakefileTargetGenerator::DriveCustomCommands( std::vector& depends) { // Depend on all custom command outputs. - std::vector sources; - this->GeneratorTarget->GetSourceFiles( - sources, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); - for (cmSourceFile* source : sources) { - if (cmCustomCommand* cc = source->GetCustomCommand()) { - cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), - this->LocalGenerator); - cm::append(depends, ccg.GetOutputs()); - } - } + cm::append(depends, this->CustomCommandOutputs); } void cmMakefileTargetGenerator::WriteObjectDependRules( @@ -1360,6 +1351,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile( this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi.first, objFullPath, srcFullPath); } + + this->CustomCommandOutputs.insert(outputs.begin(), outputs.end()); } void cmMakefileTargetGenerator::MakeEchoProgress( diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index fd6dac8..b7ec442 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -228,6 +228,9 @@ protected: // Set of extra output files to be driven by the build. std::set ExtraFiles; + // Set of custom command output files to be driven by the build. + std::set CustomCommandOutputs; + using MultipleOutputPairsType = std::map; MultipleOutputPairsType MultipleOutputPairs; bool WriteMakeRule(std::ostream& os, const char* comment, -- cgit v0.12