cmNinjaTargetGenerator: avoid traversing old outputs repeatedly

We actually only need to look at outputs just added to the vector, not
all outputs that have been detected so far.
This commit is contained in:
Ben Boeckel
2023-10-19 22:11:33 -04:00
parent dec211da56
commit 51f9d9f0a2
+3
View File
@@ -1048,10 +1048,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
cmCustomCommandGenerator ccg(*cc, config, this->GetLocalGenerator());
const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
const std::vector<std::string>& ccbyproducts = ccg.GetByproducts();
auto const nPreviousOutputs = ccouts.size();
ccouts.insert(ccouts.end(), ccoutputs.begin(), ccoutputs.end());
ccouts.insert(ccouts.end(), ccbyproducts.begin(), ccbyproducts.end());
if (usePrivateGeneratedSources) {
auto it = ccouts.begin();
// Skip over outputs that were already detected.
std::advance(it, nPreviousOutputs);
while (it != ccouts.end()) {
cmFileSet const* fileset =
this->GeneratorTarget->GetFileSetForSource(