[Cmake-commits] [cmake-commits] king committed cmGlobalGenerator.cxx 1.256 1.257

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Sep 2 16:06:45 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv15869/Source

Modified Files:
	cmGlobalGenerator.cxx 
Log Message:
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.


Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.256
retrieving revision 1.257
diff -C 2 -d -r1.256 -r1.257
*** cmGlobalGenerator.cxx	4 Aug 2009 18:37:46 -0000	1.256
--- cmGlobalGenerator.cxx	2 Sep 2009 20:06:43 -0000	1.257
***************
*** 1972,1983 ****
  {
    // 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
      for(cmGlobalGenerator::TargetDependSet::const_iterator i =
            tset.begin(); i != tset.end(); ++i)
--- 1972,1981 ----
  {
    // add the target itself
!   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)



More information about the Cmake-commits mailing list