From 51f9d9f0a2a85744e9214aaa24054fabb9e79355 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 19 Oct 2023 22:11:33 -0400 Subject: 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. --- Source/cmNinjaTargetGenerator.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 0bda945..af47158 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1048,10 +1048,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( cmCustomCommandGenerator ccg(*cc, config, this->GetLocalGenerator()); const std::vector& ccoutputs = ccg.GetOutputs(); const std::vector& 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( -- cgit v0.12