Browse Source

Split CreateGeneratorTargets into two methods.

As the generate-time-related API is moving to cmGeneratorTarget, almost
all of generation code needs to be able to access instances of it.
Stephen Kelly 13 years ago
parent
commit
25f1df3e81

+ 0 - 2
Source/cmGeneratorTarget.cxx

@@ -25,8 +25,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
   this->Makefile = this->Target->GetMakefile();
   this->LocalGenerator = this->Makefile->GetLocalGenerator();
   this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
-  this->ClassifySources();
-  this->LookupObjectLibraries();
 }
 
 //----------------------------------------------------------------------------

+ 1 - 1
Source/cmGeneratorTarget.h

@@ -74,10 +74,10 @@ public:
 
   bool IsSystemIncludeDirectory(const char *dir, const char *config);
 
-private:
   void ClassifySources();
   void LookupObjectLibraries();
 
+private:
   std::map<std::string, std::vector<std::string> > SystemIncludesCache;
 
   cmGeneratorTarget(cmGeneratorTarget const&);

+ 23 - 3
Source/cmGlobalGenerator.cxx

@@ -1058,6 +1058,9 @@ void cmGlobalGenerator::Generate()
     this->LocalGenerators[i]->AddHelperCommands();
     }
 
+  // Create per-target generator information.
+  this->CreateGeneratorTargets();
+
   // Trace the dependencies, after that no custom commands should be added
   // because their dependencies might not be handled correctly
   for (i = 0; i < this->LocalGenerators.size(); ++i)
@@ -1071,8 +1074,7 @@ void cmGlobalGenerator::Generate()
     this->LocalGenerators[i]->GenerateTargetManifest();
     }
 
-  // Create per-target generator information.
-  this->CreateGeneratorTargets();
+  this->ComputeGeneratorTargetObjects();
 
   this->ProcessEvaluationFiles();
 
@@ -1263,7 +1265,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
 
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       this->GeneratorTargets[t] = gt;
-      this->ComputeTargetObjects(gt);
       generatorTargets[t] = gt;
       }
 
@@ -1280,6 +1281,25 @@ void cmGlobalGenerator::CreateGeneratorTargets()
     }
 }
 
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::ComputeGeneratorTargetObjects()
+{
+  // Construct per-target generator information.
+  for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
+    {
+    cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
+    cmGeneratorTargetsType targets = mf->GetGeneratorTargets();
+    for(cmGeneratorTargetsType::iterator ti = targets.begin();
+        ti != targets.end(); ++ti)
+      {
+      cmGeneratorTarget* gt = ti->second;
+      gt->ClassifySources();
+      gt->LookupObjectLibraries();
+      this->ComputeTargetObjects(gt);
+      }
+    }
+}
+
 //----------------------------------------------------------------------------
 void cmGlobalGenerator::ClearGeneratorTargets()
 {

+ 1 - 0
Source/cmGlobalGenerator.h

@@ -406,6 +406,7 @@ private:
   // Per-target generator information.
   cmGeneratorTargetsType GeneratorTargets;
   void CreateGeneratorTargets();
+  void ComputeGeneratorTargetObjects();
   void ClearGeneratorTargets();
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;