Commit 0af3b3b8 authored by Brad King's avatar Brad King
Browse files

Speed up graph traversal for project->targets map

The cmGlobalGenerator::AddTargetDepends method traces the dependencies
of targets recursively to collect the complete set of targets needed for
a given project (for VS .sln files).  This commit teaches the method to
avoid tracing its dependencies more than once.  Otherwise the code does
an all-paths walk needlessly.
parent 7e20db02
......@@ -1971,14 +1971,12 @@ cmGlobalGenerator::AddTargetDepends(cmTarget* target,
projectTargets)
{
// add the target itself
projectTargets.insert(target);
// get the direct depends of target
cmGlobalGenerator::TargetDependSet const& tset
= this->GetTargetDirectDepends(*target);
if(tset.size())
{
// if there are targets that depend on target
// add them and their depends as well
if(projectTargets.insert(target).second)
{
// This is the first time we have encountered the target.
// Recursively follow its dependencies.
cmGlobalGenerator::TargetDependSet const& tset
= this->GetTargetDirectDepends(*target);
for(cmGlobalGenerator::TargetDependSet::const_iterator i =
tset.begin(); i != tset.end(); ++i)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment