cmMakefileTargetGenerator: Simplify custom command output collection

This commit is contained in:
Brad King
2020-09-04 13:53:34 -04:00
parent b1b345c21a
commit 844779bdc1
2 changed files with 6 additions and 10 deletions

View File

@@ -1290,16 +1290,7 @@ void cmMakefileTargetGenerator::DriveCustomCommands(
std::vector<std::string>& depends)
{
// Depend on all custom command outputs.
std::vector<cmSourceFile*> 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(

View File

@@ -228,6 +228,9 @@ protected:
// Set of extra output files to be driven by the build.
std::set<std::string> ExtraFiles;
// Set of custom command output files to be driven by the build.
std::set<std::string> CustomCommandOutputs;
using MultipleOutputPairsType = std::map<std::string, std::string>;
MultipleOutputPairsType MultipleOutputPairs;
bool WriteMakeRule(std::ostream& os, const char* comment,