Ver Fonte

Port to GetGeneratorTargets.

Stephen Kelly há 10 anos atrás
pai
commit
67b2f4312c

+ 4 - 5
Source/cmComputeTargetDepends.cxx

@@ -175,13 +175,12 @@ void cmComputeTargetDepends::CollectTargets()
     this->GlobalGenerator->GetLocalGenerators();
   for(unsigned int i = 0; i < lgens.size(); ++i)
     {
-    const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets();
-    for(cmTargets::const_iterator ti = targets.begin();
+    const std::vector<cmGeneratorTarget*> targets =
+        lgens[i]->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
         ti != targets.end(); ++ti)
       {
-      cmTarget const* target = &ti->second;
-      cmGeneratorTarget* gt =
-          this->GlobalGenerator->GetGeneratorTarget(target);
+      cmGeneratorTarget* gt = *ti;
       int index = static_cast<int>(this->Targets.size());
       this->TargetIndex[gt] = index;
       this->Targets.push_back(gt);

+ 19 - 20
Source/cmExtraCodeBlocksGenerator.cxx

@@ -319,12 +319,12 @@ void cmExtraCodeBlocksGenerator
   for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
        lg!=lgs.end(); lg++)
     {
-    cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -333,7 +333,7 @@ void cmExtraCodeBlocksGenerator
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
                      (*lg)->GetBinaryDirectory())==0)
             {
-            this->AppendTarget(fout, ti->first, 0,
+            this->AppendTarget(fout, targetName, 0,
                                make.c_str(), *lg, compiler.c_str());
             }
           }
@@ -341,15 +341,16 @@ void cmExtraCodeBlocksGenerator
         case cmState::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
-          if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-             || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-             || ((ti->first.find("Experimental")==0)
-                                               && (ti->first!="Experimental")))
+          if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+             || ((targetName.find("Continuous")==0)
+                 &&(targetName!="Continuous"))
+             || ((targetName.find("Experimental")==0)
+                                             && (targetName!="Experimental")))
             {
             break;
             }
 
-          this->AppendTarget(fout, ti->first, 0,
+          this->AppendTarget(fout, targetName, 0,
                                  make.c_str(), *lg, compiler.c_str());
           break;
         case cmState::EXECUTABLE:
@@ -358,11 +359,10 @@ void cmExtraCodeBlocksGenerator
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
-          this->AppendTarget(fout, ti->first, gt,
+          cmGeneratorTarget* gt = *ti;
+          this->AppendTarget(fout, targetName, gt,
                              make.c_str(), *lg, compiler.c_str());
-          std::string fastTarget = ti->first;
+          std::string fastTarget = targetName;
           fastTarget += "/fast";
           this->AppendTarget(fout, fastTarget, gt,
                              make.c_str(), *lg, compiler.c_str());
@@ -388,11 +388,11 @@ void cmExtraCodeBlocksGenerator
        lg!=lgs.end(); lg++)
     {
     cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -402,8 +402,7 @@ void cmExtraCodeBlocksGenerator
         case cmState::UTILITY: // can have sources since 2.6.3
           {
           std::vector<cmSourceFile*> sources;
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
+          cmGeneratorTarget* gt = *ti;
           gt->GetSourceFiles(sources,
                             makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
           for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
@@ -442,7 +441,7 @@ void cmExtraCodeBlocksGenerator
               }
 
             CbpUnit &cbpUnit = allFiles[fullPath];
-            cbpUnit.Targets.push_back(&(ti->second));
+            cbpUnit.Targets.push_back((*ti)->Target);
             }
           }
         default:  // intended fallthrough

+ 5 - 6
Source/cmExtraCodeLiteGenerator.cxx

@@ -155,12 +155,12 @@ void cmExtraCodeLiteGenerator
        lg!=lgs.end(); lg++)
     {
     cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
 
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
           {
@@ -186,7 +186,7 @@ void cmExtraCodeLiteGenerator
           break;
         }
 
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -194,8 +194,7 @@ void cmExtraCodeLiteGenerator
         case cmState::MODULE_LIBRARY:
           {
           std::vector<cmSourceFile*> sources;
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
+          cmGeneratorTarget* gt = *ti;
           gt->GetSourceFiles(sources,
                             makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
           for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();

+ 26 - 24
Source/cmExtraEclipseCDT4Generator.cxx

@@ -536,13 +536,15 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
        ++lgIt)
     {
     cmMakefile* makefile = (*lgIt)->GetMakefile();
-    const cmTargets& targets = makefile->GetTargets();
+    const std::vector<cmGeneratorTarget*> targets =
+        (*lgIt)->GetGeneratorTargets();
 
-    for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti)
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti=targets.begin();
+        ti!=targets.end();++ti)
       {
       std::string linkName2 = linkName;
       linkName2 += "/";
-      switch(ti->second.GetType())
+      switch((*ti)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -550,10 +552,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ?
+          const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
                                                           "[exe] " : "[lib] ");
           linkName2 += prefix;
-          linkName2 += ti->first;
+          linkName2 += (*ti)->GetName();
           this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
                                      VirtualFolder);
           if (!this->GenerateLinkedResources)
@@ -562,10 +564,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
             }
           std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
           // get the files from the source lists then add them to the groups
-          cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
+          cmGeneratorTarget* gt = const_cast<cmGeneratorTarget*>(*ti);
           std::vector<cmSourceFile*> files;
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(tgt);
           gt->GetSourceFiles(files,
                             makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
           for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
@@ -1030,7 +1030,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
        it != this->GlobalGenerator->GetLocalGenerators().end();
        ++it)
     {
-    const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
+    const std::vector<cmGeneratorTarget*> targets =
+        (*it)->GetGeneratorTargets();
     std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
                            cmLocalGenerator::HOME_OUTPUT);
     if (subdir == ".")
@@ -1038,9 +1039,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
       subdir = "";
       }
 
-    for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti)
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti =
+        targets.begin(); ti!=targets.end(); ++ti)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -1048,22 +1051,22 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
           // not from the subdirs
           if (subdir.empty())
            {
-           this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": ");
+           this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
            }
          }
          break;
        case cmState::UTILITY:
          // Add all utility targets, except the Nightly/Continuous/
          // Experimental-"sub"targets as e.g. NightlyStart
-         if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-          || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-          || ((ti->first.find("Experimental")==0)
-                                            && (ti->first!="Experimental")))
+         if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+          || ((targetName.find("Continuous")==0)&&(targetName!="Continuous"))
+          || ((targetName.find("Experimental")==0)
+                                            && (targetName!="Experimental")))
            {
            break;
            }
 
-         this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": ");
+         this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
          break;
        case cmState::EXECUTABLE:
        case cmState::STATIC_LIBRARY:
@@ -1071,10 +1074,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
        case cmState::MODULE_LIBRARY:
        case cmState::OBJECT_LIBRARY:
          {
-         const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ?
+         const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
                                                           "[exe] " : "[lib] ");
-         this->AppendTarget(fout, ti->first, make, makeArgs, subdir, prefix);
-         std::string fastTarget = ti->first;
+         this->AppendTarget(fout, targetName, make, makeArgs, subdir, prefix);
+         std::string fastTarget = targetName;
          fastTarget += "/fast";
          this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
 
@@ -1083,21 +1086,20 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
           {
           std::string virtDir = "[Targets]/";
           virtDir += prefix;
-          virtDir += ti->first;
+          virtDir += targetName;
           std::string buildArgs = "-C \"";
           buildArgs += (*it)->GetBinaryDirectory();
           buildArgs += "\" ";
           buildArgs += makeArgs;
           this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
-                             ti->first.c_str());
+                             targetName.c_str());
 
           std::string cleanArgs = "-E chdir \"";
           cleanArgs += (*it)->GetCurrentBinaryDirectory();
           cleanArgs += "\" \"";
           cleanArgs += cmSystemTools::GetCMakeCommand();
           cleanArgs += "\" -P \"";
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&ti->second);
+          cmGeneratorTarget* gt = *ti;
           cleanArgs += (*it)->GetTargetDirectory(gt);
           cleanArgs += "/cmake_clean.cmake\"";
           this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(),

+ 17 - 14
Source/cmExtraKateGenerator.cxx

@@ -119,14 +119,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
        it != this->GlobalGenerator->GetLocalGenerators().end();
        ++it)
     {
-    const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
-    cmMakefile* makefile=(*it)->GetMakefile();
+    const std::vector<cmGeneratorTarget*> targets =
+        (*it)->GetGeneratorTargets();
     std::string currentDir = (*it)->GetCurrentBinaryDirectory();
     bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
 
-    for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti)
+    for(std::vector<cmGeneratorTarget*>::const_iterator ti =
+        targets.begin(); ti!=targets.end(); ++ti)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -138,9 +140,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
             insertTarget = true;
             // only add the "edit_cache" target if it's not ccmake, because
             // this will not work within the IDE
-            if (ti->first == "edit_cache")
+            if (targetName == "edit_cache")
               {
-              const char* editCommand = makefile->GetDefinition
+              const char* editCommand = (*it)->GetMakefile()->GetDefinition
               ("CMAKE_EDIT_COMMAND");
               if (editCommand == 0)
                 {
@@ -154,7 +156,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
             }
           if (insertTarget)
             {
-            this->AppendTarget(fout, ti->first, make, makeArgs,
+            this->AppendTarget(fout, targetName, make, makeArgs,
                                currentDir, homeOutputDir);
             }
         }
@@ -162,15 +164,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
         case cmState::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
-          if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-            || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-            || ((ti->first.find("Experimental")==0)
-            && (ti->first!="Experimental")))
+          if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+            || ((targetName.find("Continuous")==0)
+                &&(targetName!="Continuous"))
+            || ((targetName.find("Experimental")==0)
+            && (targetName!="Experimental")))
             {
               break;
             }
 
-            this->AppendTarget(fout, ti->first, make, makeArgs,
+            this->AppendTarget(fout, targetName, make, makeArgs,
                                currentDir, homeOutputDir);
           break;
         case cmState::EXECUTABLE:
@@ -179,9 +182,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
         {
-          this->AppendTarget(fout, ti->first, make, makeArgs,
+          this->AppendTarget(fout, targetName, make, makeArgs,
                              currentDir, homeOutputDir);
-          std::string fastTarget = ti->first;
+          std::string fastTarget = targetName;
           fastTarget += "/fast";
           this->AppendTarget(fout, fastTarget, make, makeArgs,
                              currentDir, homeOutputDir);

+ 14 - 12
Source/cmExtraSublimeTextGenerator.cxx

@@ -162,11 +162,12 @@ void cmExtraSublimeTextGenerator::
        lg!=lgs.end(); lg++)
     {
     cmMakefile* makefile=(*lg)->GetMakefile();
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
-      switch(ti->second.GetType())
+      std::string targetName = (*ti)->GetName();
+      switch((*ti)->GetType())
         {
         case cmState::GLOBAL_TARGET:
           {
@@ -175,7 +176,7 @@ void cmExtraSublimeTextGenerator::
           if (strcmp((*lg)->GetCurrentBinaryDirectory(),
                      (*lg)->GetBinaryDirectory())==0)
             {
-            this->AppendTarget(fout, ti->first, *lg, 0,
+            this->AppendTarget(fout, targetName, *lg, 0,
                                make.c_str(), makefile, compiler.c_str(),
                                sourceFileFlags, false);
             }
@@ -184,15 +185,16 @@ void cmExtraSublimeTextGenerator::
         case cmState::UTILITY:
           // Add all utility targets, except the Nightly/Continuous/
           // Experimental-"sub"targets as e.g. NightlyStart
-          if (((ti->first.find("Nightly")==0)   &&(ti->first!="Nightly"))
-             || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
-             || ((ti->first.find("Experimental")==0)
-                                               && (ti->first!="Experimental")))
+          if (((targetName.find("Nightly")==0)   &&(targetName!="Nightly"))
+             || ((targetName.find("Continuous")==0)
+                 &&(targetName!="Continuous"))
+             || ((targetName.find("Experimental")==0)
+                 && (targetName!="Experimental")))
             {
             break;
             }
 
-          this->AppendTarget(fout, ti->first, *lg, 0,
+          this->AppendTarget(fout, targetName, *lg, 0,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
           break;
@@ -202,12 +204,12 @@ void cmExtraSublimeTextGenerator::
         case cmState::MODULE_LIBRARY:
         case cmState::OBJECT_LIBRARY:
           {
-          this->AppendTarget(fout, ti->first, *lg, &ti->second,
+          this->AppendTarget(fout, targetName, *lg, (*ti)->Target,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
-          std::string fastTarget = ti->first;
+          std::string fastTarget = targetName;
           fastTarget += "/fast";
-          this->AppendTarget(fout, fastTarget, *lg, &ti->second,
+          this->AppendTarget(fout, fastTarget, *lg, (*ti)->Target,
                              make.c_str(), makefile, compiler.c_str(),
                              sourceFileFlags, false);
           }

+ 23 - 24
Source/cmGlobalGenerator.cxx

@@ -1468,34 +1468,34 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
 #ifdef CMAKE_BUILD_WITH_CMAKE
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
-    cmTargets& targets =
-      this->LocalGenerators[i]->GetMakefile()->GetTargets();
+    std::vector<cmGeneratorTarget*> targets =
+      this->LocalGenerators[i]->GetGeneratorTargets();
     std::vector<cmGeneratorTarget*> filteredTargets;
     filteredTargets.reserve(targets.size());
-    for(cmTargets::iterator ti = targets.begin();
+    for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
         ti != targets.end(); ++ti)
       {
-      if (ti->second.GetType() == cmState::GLOBAL_TARGET)
+      if ((*ti)->GetType() == cmState::GLOBAL_TARGET)
         {
         continue;
         }
-      if(ti->second.GetType() != cmState::EXECUTABLE &&
-         ti->second.GetType() != cmState::STATIC_LIBRARY &&
-         ti->second.GetType() != cmState::SHARED_LIBRARY &&
-         ti->second.GetType() != cmState::MODULE_LIBRARY &&
-         ti->second.GetType() != cmState::OBJECT_LIBRARY)
+      if((*ti)->GetType() != cmState::EXECUTABLE &&
+         (*ti)->GetType() != cmState::STATIC_LIBRARY &&
+         (*ti)->GetType() != cmState::SHARED_LIBRARY &&
+         (*ti)->GetType() != cmState::MODULE_LIBRARY &&
+         (*ti)->GetType() != cmState::OBJECT_LIBRARY)
         {
         continue;
         }
-      if((!ti->second.GetPropertyAsBool("AUTOMOC")
-            && !ti->second.GetPropertyAsBool("AUTOUIC")
-            && !ti->second.GetPropertyAsBool("AUTORCC"))
-          || ti->second.IsImported())
+      if((!(*ti)->GetPropertyAsBool("AUTOMOC")
+            && !(*ti)->GetPropertyAsBool("AUTOUIC")
+            && !(*ti)->GetPropertyAsBool("AUTORCC"))
+          || (*ti)->IsImported())
         {
         continue;
         }
       // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
-      cmMakefile* mf = ti->second.GetMakefile();
+      cmMakefile* mf = (*ti)->Target->GetMakefile();
       std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR");
       if (qtMajorVersion == "")
         {
@@ -1506,7 +1506,7 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
         continue;
         }
 
-      cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second);
+      cmGeneratorTarget* gt = *ti;
 
       cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt);
       filteredTargets.push_back(gt);
@@ -2706,23 +2706,22 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
       {
       continue;
       }
-    cmMakefile* mf = (*i)->GetMakefile();
     // Get the targets in the makefile
-    cmTargets &tgts = mf->GetTargets();
+    std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
     // loop over all the targets
-    for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+    for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+         l != tgts.end(); ++l)
       {
-      cmTarget* target = &l->second;
-      cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
-      if(this->IsRootOnlyTarget(gt) &&
-         target->GetMakefile() != root->GetMakefile())
+      cmGeneratorTarget* target = *l;
+      if(this->IsRootOnlyTarget(target) &&
+         target->GetLocalGenerator() != root)
         {
         continue;
         }
       // put the target in the set of original targets
-      originalTargets.insert(gt);
+      originalTargets.insert(target);
       // Get the set of targets that depend on target
-      this->AddTargetDepends(gt, projectTargets);
+      this->AddTargetDepends(target, projectTargets);
       }
     }
 }

+ 4 - 5
Source/cmGlobalKdevelopGenerator.cxx

@@ -133,14 +133,13 @@ bool cmGlobalKdevelopGenerator
       }
 
     //get all sources
-    cmTargets& targets=makefile->GetTargets();
-    for (cmTargets::iterator ti = targets.begin();
+    std::vector<cmGeneratorTarget*> targets=(*it)->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
          ti != targets.end(); ti++)
       {
       std::vector<cmSourceFile*> sources;
-      cmGeneratorTarget* gt =
-          this->GlobalGenerator->GetGeneratorTarget(&ti->second);
-      gt->GetSourceFiles(sources, ti->second.GetMakefile()
+      cmGeneratorTarget* gt = *ti;
+      gt->GetSourceFiles(sources, gt->Target->GetMakefile()
                                     ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
       for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
            si!=sources.end(); si++)

+ 20 - 20
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -423,17 +423,18 @@ void cmGlobalUnixMakefileGenerator3
     {
     lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
     // for all of out targets
-    for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
-         l != lg->GetMakefile()->GetTargets().end(); l++)
+    std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
+    for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+         l != tgts.end(); l++)
       {
-      if((l->second.GetType() == cmState::EXECUTABLE) ||
-         (l->second.GetType() == cmState::STATIC_LIBRARY) ||
-         (l->second.GetType() == cmState::SHARED_LIBRARY) ||
-         (l->second.GetType() == cmState::MODULE_LIBRARY) ||
-         (l->second.GetType() == cmState::OBJECT_LIBRARY) ||
-         (l->second.GetType() == cmState::UTILITY))
+      if(((*l)->GetType() == cmState::EXECUTABLE) ||
+         ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
+         ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
+         ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
+         ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
+         ((*l)->GetType() == cmState::UTILITY))
         {
-        cmGeneratorTarget* gt = this->GetGeneratorTarget(&l->second);
+        cmGeneratorTarget* gt = *l;
         std::string tname = lg->GetRelativeTargetDirectory(gt);
         tname += "/DependInfo.cmake";
         cmSystemTools::ConvertToUnixSlashes(tname);
@@ -914,13 +915,11 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
       lgi != this->LocalGenerators.end(); ++lgi)
     {
     cmLocalGenerator* lg = *lgi;
-    cmMakefile* mf = lg->GetMakefile();
-    cmTargets const& targets = mf->GetTargets();
-    for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
+    std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
+        t != targets.end(); ++t)
       {
-      cmTarget const& target = t->second;
-
-      cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+      cmGeneratorTarget* gt = *t;
 
       cmLocalGenerator* tlg = gt->GetLocalGenerator();
 
@@ -1089,11 +1088,12 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
     if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
       {
       // for each target Generate the rule files for each target.
-      cmTargets& targets = lg2->GetMakefile()->GetTargets();
-      for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+      std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
+      for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
+          t != targets.end(); ++t)
         {
-        cmTarget const& target = t->second;
-        cmState::TargetType type = target.GetType();
+        cmGeneratorTarget* target = *t;
+        cmState::TargetType type = target->GetType();
         if((type == cmState::EXECUTABLE) ||
            (type == cmState::STATIC_LIBRARY) ||
            (type == cmState::SHARED_LIBRARY) ||
@@ -1102,7 +1102,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
            (type == cmState::GLOBAL_TARGET) ||
            (type == cmState::UTILITY))
           {
-          std::string name = target.GetName();
+          std::string name = target->GetName();
           if(emittedTargets.insert(name).second)
             {
             path = "... ";

+ 3 - 3
Source/cmGlobalVisualStudioGenerator.cxx

@@ -375,11 +375,11 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
     for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
         i != gen.end(); ++i)
       {
-      cmTargets& targets = (*i)->GetMakefile()->GetTargets();
-      for(cmTargets::iterator ti = targets.begin();
+      std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
+      for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
           ti != targets.end(); ++ti)
         {
-        this->ComputeVSTargetDepends(ti->second);
+        this->ComputeVSTargetDepends(*(*ti)->Target);
         }
       }
     }

+ 23 - 14
Source/cmGlobalXCodeGenerator.cxx

@@ -510,17 +510,20 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
       continue;
       }
 
-    cmTargets& tgts = lg->GetMakefile()->GetTargets();
-    for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+    std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+        l != tgts.end(); l++)
       {
-      cmTarget& target = l->second;
+      cmTarget& target = *(*l)->Target;
 
       if (target.GetType() == cmState::GLOBAL_TARGET)
         {
         continue;
         }
 
-      if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
+      std::string targetName = target.GetName();
+
+      if (regenerate && (targetName != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
         {
         target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
         }
@@ -1085,21 +1088,26 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
                                            targets)
 {
   this->SetCurrentLocalGenerator(gen);
-  cmTargets &tgts = this->CurrentMakefile->GetTargets();
-  typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets;
+  std::vector<cmGeneratorTarget*> tgts =
+      this->CurrentLocalGenerator->GetGeneratorTargets();
+  typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
+      cmSortedTargets;
   cmSortedTargets sortedTargets;
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); l++)
     {
-    sortedTargets[l->first] = &l->second;
+    sortedTargets[(*l)->GetName()] = *l;
     }
   for(cmSortedTargets::iterator l = sortedTargets.begin();
       l != sortedTargets.end(); l++)
     {
-    cmTarget& cmtarget = *l->second;
-    cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
+    cmGeneratorTarget* gtgt = l->second;
+    cmTarget& cmtarget = *gtgt->Target;
+
+    std::string targetName = gtgt->GetName();
 
     // make sure ALL_BUILD, INSTALL, etc are only done once
-    if(this->SpecialTargetEmitted(l->first.c_str()))
+    if(this->SpecialTargetEmitted(targetName.c_str()))
       {
       continue;
       }
@@ -3062,10 +3070,11 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
       }
     cmMakefile* mf = (*i)->GetMakefile();
     std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
-    cmTargets &tgts = mf->GetTargets();
-    for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+    std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
+    for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+        l != tgts.end(); l++)
       {
-      cmTarget& cmtarget = l->second;
+      cmTarget& cmtarget = *(*l)->Target;
 
       // Same skipping logic here as in CreateXCodeTargets so that we do not
       // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source

+ 14 - 13
Source/cmLocalGenerator.cxx

@@ -2510,28 +2510,29 @@ cmLocalGenerator
 {
   // Convert the old-style install specification from each target to
   // an install generator and run it.
-  cmTargets& tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if (l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if ((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
 
     // Include the user-specified pre-install script for this target.
-    if(const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT"))
+    if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT"))
       {
       cmInstallScriptGenerator g(preinstall, false, 0);
       g.Generate(os, config, configurationTypes);
       }
 
     // Install this target if a destination is given.
-    if(l->second.GetInstallPath() != "")
+    if((*l)->Target->GetInstallPath() != "")
       {
       // Compute the full install destination.  Note that converting
       // to unix slashes also removes any trailing slash.
       // We also skip over the leading slash given by the user.
-      std::string destination = l->second.GetInstallPath().substr(1);
+      std::string destination = (*l)->Target->GetInstallPath().substr(1);
       cmSystemTools::ConvertToUnixSlashes(destination);
       if(destination.empty())
         {
@@ -2539,7 +2540,7 @@ cmLocalGenerator
         }
 
       // Generate the proper install generator for this target type.
-      switch(l->second.GetType())
+      switch((*l)->GetType())
         {
         case cmState::EXECUTABLE:
         case cmState::STATIC_LIBRARY:
@@ -2547,7 +2548,7 @@ cmLocalGenerator
           {
           // Use a target install generator.
           cmInstallTargetGeneratorLocal
-            g(this, l->first, destination.c_str(), false);
+            g(this, (*l)->GetName(), destination.c_str(), false);
           g.Generate(os, config, configurationTypes);
           }
           break;
@@ -2558,18 +2559,18 @@ cmLocalGenerator
           // to the normal destination and the DLL to the runtime
           // destination.
           cmInstallTargetGeneratorLocal
-            g1(this, l->first, destination.c_str(), true);
+            g1(this, (*l)->GetName(), destination.c_str(), true);
           g1.Generate(os, config, configurationTypes);
           // We also skip over the leading slash given by the user.
-          destination = l->second.GetRuntimeInstallPath().substr(1);
+          destination = (*l)->Target->GetRuntimeInstallPath().substr(1);
           cmSystemTools::ConvertToUnixSlashes(destination);
           cmInstallTargetGeneratorLocal
-            g2(this, l->first, destination.c_str(), false);
+            g2(this, (*l)->GetName(), destination.c_str(), false);
           g2.Generate(os, config, configurationTypes);
 #else
           // Use a target install generator.
           cmInstallTargetGeneratorLocal
-            g(this, l->first, destination.c_str(), false);
+            g(this, (*l)->GetName(), destination.c_str(), false);
           g.Generate(os, config, configurationTypes);
 #endif
           }
@@ -2580,7 +2581,7 @@ cmLocalGenerator
       }
 
     // Include the user-specified post-install script for this target.
-    if(const char* postinstall = l->second.GetProperty("POST_INSTALL_SCRIPT"))
+    if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT"))
       {
       cmInstallScriptGenerator g(postinstall, false, 0);
       g.Generate(os, config, configurationTypes);

+ 15 - 15
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -1762,43 +1762,43 @@ void cmLocalUnixMakefileGenerator3
   ruleFileStream
     << "# Targets provided globally by CMake.\n"
     << "\n";
-  cmTargets* targets = &(this->Makefile->GetTargets());
-  cmTargets::iterator glIt;
-  for ( glIt = targets->begin(); glIt != targets->end(); ++ glIt )
+  std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
+  std::vector<cmGeneratorTarget*>::iterator glIt;
+  for ( glIt = targets.begin(); glIt != targets.end(); ++ glIt )
     {
-    if ( glIt->second.GetType() == cmState::GLOBAL_TARGET )
+    if ( (*glIt)->GetType() == cmState::GLOBAL_TARGET )
       {
-      std::string targetString = "Special rule for the target " + glIt->first;
+      std::string targetString = "Special rule for the target " +
+          (*glIt)->GetName();
       std::vector<std::string> commands;
       std::vector<std::string> depends;
 
-      const char* text = glIt->second.GetProperty("EchoString");
+      const char* text = (*glIt)->GetProperty("EchoString");
       if ( !text )
         {
         text = "Running external command ...";
         }
-      depends.insert(depends.end(), glIt->second.GetUtilities().begin(),
-                     glIt->second.GetUtilities().end());
+      depends.insert(depends.end(), (*glIt)->Target->GetUtilities().begin(),
+                     (*glIt)->Target->GetUtilities().end());
       this->AppendEcho(commands, text,
                        cmLocalUnixMakefileGenerator3::EchoGlobal);
 
-      cmGeneratorTarget* gt = this->GlobalGenerator
-          ->GetGeneratorTarget(&glIt->second);
+      cmGeneratorTarget* gt = *glIt;
 
       // Global targets store their rules in pre- and post-build commands.
       this->AppendCustomDepends(depends,
-                                glIt->second.GetPreBuildCommands());
+                                gt->Target->GetPreBuildCommands());
       this->AppendCustomDepends(depends,
-                                glIt->second.GetPostBuildCommands());
+                                gt->Target->GetPostBuildCommands());
       this->AppendCustomCommands(commands,
-                                 glIt->second.GetPreBuildCommands(),
+                                 gt->Target->GetPreBuildCommands(),
                                  gt,
                                  cmLocalGenerator::START_OUTPUT);
       this->AppendCustomCommands(commands,
-                                 glIt->second.GetPostBuildCommands(),
+                                 gt->Target->GetPostBuildCommands(),
                                  gt,
                                  cmLocalGenerator::START_OUTPUT);
-      std::string targetName = glIt->second.GetName();
+      std::string targetName = gt->GetName();
       this->WriteMakeRule(ruleFileStream, targetString.c_str(),
                           targetName, depends, commands, true);
 

+ 7 - 6
Source/cmLocalVisualStudio10Generator.cxx

@@ -74,22 +74,23 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
 void cmLocalVisualStudio10Generator::Generate()
 {
 
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if(l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
     if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
-       ->TargetIsFortranOnly(l->second))
+       ->TargetIsFortranOnly(*(*l)->Target))
       {
-      this->CreateSingleVCProj(l->first.c_str(),l->second);
+      this->CreateSingleVCProj((*l)->GetName().c_str(), *(*l)->Target);
       }
     else
       {
       cmVisualStudio10TargetGenerator tg(
-        &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
+        (*l)->Target, static_cast<cmGlobalVisualStudio10Generator*>(
           this->GetGlobalGenerator()));
       tg.Generate();
       }

+ 23 - 21
Source/cmLocalVisualStudio6Generator.cxx

@@ -82,12 +82,12 @@ private:
 
 void cmLocalVisualStudio6Generator::AddCMakeListsRules()
 {
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin();
-      l != tgts.end(); l++)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if (l->second.GetType() == cmState::INTERFACE_LIBRARY
-        || l->second.GetType() == cmState::GLOBAL_TARGET)
+    if ((*l)->GetType() == cmState::INTERFACE_LIBRARY
+        || (*l)->GetType() == cmState::GLOBAL_TARGET)
       {
       continue;
       }
@@ -98,7 +98,7 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules()
       this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION");
     if (!cmSystemTools::IsOn(suppRegenRule))
       {
-      this->AddDSPBuildRule(l->second);
+      this->AddDSPBuildRule(*(*l)->Target);
       }
     }
 }
@@ -124,54 +124,56 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
 
   // Create the DSP or set of DSP's for libraries and executables
 
-  cmTargets &tgts = this->Makefile->GetTargets();
-
-  // build any targets
-  for(cmTargets::iterator l = tgts.begin();
-      l != tgts.end(); l++)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    switch(l->second.GetType())
+    switch((*l)->GetType())
       {
       case cmState::STATIC_LIBRARY:
       case cmState::OBJECT_LIBRARY:
-        this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second);
+        this->SetBuildType(STATIC_LIBRARY,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::SHARED_LIBRARY:
       case cmState::MODULE_LIBRARY:
-        this->SetBuildType(DLL, l->first.c_str(), l->second);
+        this->SetBuildType(DLL,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::EXECUTABLE:
-        this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second);
+        this->SetBuildType(EXECUTABLE,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::UTILITY:
       case cmState::GLOBAL_TARGET:
-        this->SetBuildType(UTILITY, l->first.c_str(), l->second);
+        this->SetBuildType(UTILITY,
+                           (*l)->GetName().c_str(), *(*l)->Target);
         break;
       case cmState::INTERFACE_LIBRARY:
         continue;
       default:
-        cmSystemTools::Error("Bad target type: ", l->first.c_str());
+        cmSystemTools::Error("Bad target type: ", (*l)->GetName().c_str());
         break;
       }
     // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
     // so don't build a projectfile for it
     const char* path =
-      l->second.GetProperty("EXTERNAL_MSPROJECT");
+      (*l)->GetProperty("EXTERNAL_MSPROJECT");
     if(!path)
       {
       // check to see if the dsp is going into a sub-directory
-      std::string::size_type pos = l->first.rfind('/');
+      std::string::size_type pos = (*l)->GetName().rfind('/');
       if(pos != std::string::npos)
         {
         std::string dir = this->GetCurrentBinaryDirectory();
         dir += "/";
-        dir += l->first.substr(0, pos);
+        dir += (*l)->GetName().substr(0, pos);
         if(!cmSystemTools::MakeDirectory(dir.c_str()))
           {
           cmSystemTools::Error("Error creating directory: ", dir.c_str());
           }
         }
-      this->CreateSingleDSP(l->first.c_str(),l->second);
+      this->CreateSingleDSP((*l)->GetName().c_str(), *(*l)->Target);
       }
     }
 }

+ 21 - 24
Source/cmLocalVisualStudio7Generator.cxx

@@ -67,19 +67,19 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
 void cmLocalVisualStudio7Generator::AddHelperCommands()
 {
   // Now create GUIDs for targets
-  cmTargets &tgts = this->Makefile->GetTargets();
-
-  for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+      l != tgts.end(); ++l)
     {
-    if(l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
-    const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
+    const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT");
     if(path)
       {
       this->ReadAndStoreExternalGUID(
-        l->second.GetName().c_str(), path);
+        (*l)->GetName().c_str(), path);
       }
     }
 
@@ -95,7 +95,6 @@ void cmLocalVisualStudio7Generator::Generate()
 
 void cmLocalVisualStudio7Generator::AddCMakeListsRules()
 {
-  cmTargets &tgts = this->Makefile->GetTargets();
   // Create the regeneration custom rule.
   if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION"))
     {
@@ -104,17 +103,17 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
     if(cmSourceFile* sf = this->CreateVCProjBuildRule())
       {
       // Add the rule to targets that need it.
-      for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
+      std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+      for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
+          l != tgts.end(); ++l)
         {
-        if (l->second.GetType() == cmState::GLOBAL_TARGET)
+        if ((*l)->GetType() == cmState::GLOBAL_TARGET)
           {
           continue;
           }
-        if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
+        if((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
           {
-          cmGeneratorTarget* gt =
-              this->GlobalGenerator->GetGeneratorTarget(&l->second);
-          gt->AddSource(sf->GetFullPath());
+          (*l)->AddSource(sf->GetFullPath());
           }
         }
       }
@@ -126,11 +125,11 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
   // Visual Studio .NET 2003 Service Pack 1 will not run post-build
   // commands for targets in which no sources are built.  Add dummy
   // rules to force these targets to build.
-  cmTargets &tgts = this->Makefile->GetTargets();
-  for(cmTargets::iterator l = tgts.begin();
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
       l != tgts.end(); l++)
     {
-    cmTarget& tgt = l->second;
+    cmTarget& tgt = *(*l)->Target;
     if(tgt.GetType() == cmState::GLOBAL_TARGET)
       {
       std::vector<std::string> no_depends;
@@ -150,9 +149,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
            force.c_str(), no_depends, no_main_dependency,
            force_commands, " ", 0, true))
         {
-        cmGeneratorTarget* gt =
-            this->GlobalGenerator->GetGeneratorTarget(&tgt);
-        gt->AddSource(file->GetFullPath());
+        (*l)->AddSource(file->GetFullPath());
         }
       }
     }
@@ -176,21 +173,21 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
     }
 
   // Get the set of targets in this directory.
-  cmTargets &tgts = this->Makefile->GetTargets();
+  std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
 
   // Create the project file for each target.
-  for(cmTargets::iterator l = tgts.begin();
+  for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
       l != tgts.end(); l++)
     {
-    if(l->second.GetType() == cmState::INTERFACE_LIBRARY)
+    if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
       {
       continue;
       }
     // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
     // so don't build a projectfile for it
-    if(!l->second.GetProperty("EXTERNAL_MSPROJECT"))
+    if(!(*l)->GetProperty("EXTERNAL_MSPROJECT"))
       {
-      this->CreateSingleVCProj(l->first.c_str(),l->second);
+      this->CreateSingleVCProj((*l)->GetName().c_str(), *(*l)->Target);
       }
     }
 }