Browse Source

Store cmGeneratorTargets with the makefile.

Stephen Kelly 13 years ago
parent
commit
14bf7783f4
4 changed files with 24 additions and 6 deletions
  1. 2 0
      Source/cmGeneratorTarget.h
  2. 8 4
      Source/cmGlobalGenerator.cxx
  3. 2 2
      Source/cmGlobalGenerator.h
  4. 12 0
      Source/cmMakefile.h

+ 2 - 0
Source/cmGeneratorTarget.h

@@ -66,4 +66,6 @@ private:
   void operator=(cmGeneratorTarget const&);
   void operator=(cmGeneratorTarget const&);
 };
 };
 
 
+typedef std::map<cmTarget*, cmGeneratorTarget*> cmGeneratorTargetsType;
+
 #endif
 #endif

+ 8 - 4
Source/cmGlobalGenerator.cxx

@@ -1075,8 +1075,10 @@ void cmGlobalGenerator::CreateGeneratorTargets()
   // Construct per-target generator information.
   // Construct per-target generator information.
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
     {
-    cmTargets& targets =
-      this->LocalGenerators[i]->GetMakefile()->GetTargets();
+    cmGeneratorTargetsType generatorTargets;
+
+    cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
+    cmTargets& targets = mf->GetTargets();
     for(cmTargets::iterator ti = targets.begin();
     for(cmTargets::iterator ti = targets.begin();
         ti != targets.end(); ++ti)
         ti != targets.end(); ++ti)
       {
       {
@@ -1084,14 +1086,16 @@ void cmGlobalGenerator::CreateGeneratorTargets()
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       this->GeneratorTargets[t] = gt;
       this->GeneratorTargets[t] = gt;
       this->ComputeTargetObjects(gt);
       this->ComputeTargetObjects(gt);
+      generatorTargets[t] = gt;
       }
       }
+    mf->SetGeneratorTargets(generatorTargets);
     }
     }
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 void cmGlobalGenerator::ClearGeneratorTargets()
 void cmGlobalGenerator::ClearGeneratorTargets()
 {
 {
-  for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
+  for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin();
       i != this->GeneratorTargets.end(); ++i)
       i != this->GeneratorTargets.end(); ++i)
     {
     {
     delete i->second;
     delete i->second;
@@ -1102,7 +1106,7 @@ void cmGlobalGenerator::ClearGeneratorTargets()
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const
 cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const
 {
 {
-  GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
+  cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t);
   if(ti == this->GeneratorTargets.end())
   if(ti == this->GeneratorTargets.end())
     {
     {
     this->CMakeInstance->IssueMessage(
     this->CMakeInstance->IssueMessage(

+ 2 - 2
Source/cmGlobalGenerator.h

@@ -18,6 +18,7 @@
 #include "cmTarget.h" // For cmTargets
 #include "cmTarget.h" // For cmTargets
 #include "cmTargetDepend.h" // For cmTargetDependSet
 #include "cmTargetDepend.h" // For cmTargetDependSet
 #include "cmSystemTools.h" // for cmSystemTools::OutputOption
 #include "cmSystemTools.h" // for cmSystemTools::OutputOption
+#include "cmGeneratorTarget.h"
 class cmake;
 class cmake;
 class cmGeneratorTarget;
 class cmGeneratorTarget;
 class cmMakefile;
 class cmMakefile;
@@ -383,8 +384,7 @@ private:
   TargetDependMap TargetDependencies;
   TargetDependMap TargetDependencies;
 
 
   // Per-target generator information.
   // Per-target generator information.
-  typedef std::map<cmTarget*, cmGeneratorTarget*> GeneratorTargetsType;
-  GeneratorTargetsType GeneratorTargets;
+  cmGeneratorTargetsType GeneratorTargets;
   void CreateGeneratorTargets();
   void CreateGeneratorTargets();
   void ClearGeneratorTargets();
   void ClearGeneratorTargets();
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;

+ 12 - 0
Source/cmMakefile.h

@@ -20,6 +20,7 @@
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmTarget.h"
 #include "cmNewLineStyle.h"
 #include "cmNewLineStyle.h"
+#include "cmGeneratorTarget.h"
 #include "cmake.h"
 #include "cmake.h"
 
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -519,6 +520,16 @@ public:
    */
    */
   const cmTargets &GetTargets() const { return this->Targets; }
   const cmTargets &GetTargets() const { return this->Targets; }
 
 
+  const cmGeneratorTargetsType &GetGeneratorTargets() const
+    {
+      return this->GeneratorTargets;
+    }
+
+  void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
+    {
+      this->GeneratorTargets = targets;
+    }
+
   cmTarget* FindTarget(const char* name);
   cmTarget* FindTarget(const char* name);
 
 
   /** Find a target to use in place of the given name.  The target
   /** Find a target to use in place of the given name.  The target
@@ -865,6 +876,7 @@ protected:
 
 
   // libraries, classes, and executables
   // libraries, classes, and executables
   cmTargets Targets;
   cmTargets Targets;
+  cmGeneratorTargetsType GeneratorTargets;
   std::vector<cmSourceFile*> SourceFiles;
   std::vector<cmSourceFile*> SourceFiles;
 
 
   // Tests
   // Tests