diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 128679363..6c612ab21 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -955,6 +955,13 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os) void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) { + // We need to collect the set of known build outputs. + // Start with those generated by WriteBuild calls. + // No other method needs this so we can take ownership + // of the set locally and throw it out when we are done. + std::set knownDependencies; + knownDependencies.swap(this->CombinedBuildOutputs); + //now write out the unknown explicit dependencies. //union the configured files, evaluations files and the CombinedBuildOutputs, @@ -971,7 +978,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) cmLocalNinjaGenerator *ng = static_cast(this->LocalGenerators[0]); - std::set knownDependencies; for (std::vector::const_iterator i = this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) { @@ -1026,15 +1032,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) knownDependencies.insert( ng->ConvertToNinjaPath(i->first) ); } - //insert outputs from all WirteBuild commands - //these paths have already be encoded when added to CombinedBuildOutputs - knownDependencies.insert(this->CombinedBuildOutputs.begin(), - this->CombinedBuildOutputs.end()); - - //after we have combined the data into knownDependencies we have no need - //to keep this data around - this->CombinedBuildOutputs.clear(); - //now we difference with CombinedCustomCommandExplicitDependencies to find //the list of items we know nothing about. //We have encoded all the paths in CombinedCustomCommandExplicitDependencies