Browse Source

cmGeneratorTarget: Port TraceDependencies to cmTarget.

The problem of needing cmTarget is not solved with this, but the removal
of the cmTarget member is valuable.
Stephen Kelly 10 years ago
parent
commit
82a6eaf4d0
1 changed files with 17 additions and 12 deletions
  1. 17 12
      Source/cmGeneratorTarget.cxx

+ 17 - 12
Source/cmGeneratorTarget.cxx

@@ -2120,9 +2120,9 @@ public:
   cmTargetTraceDependencies(cmGeneratorTarget* target);
   cmTargetTraceDependencies(cmGeneratorTarget* target);
   void Trace();
   void Trace();
 private:
 private:
-  cmTarget* Target;
   cmGeneratorTarget* GeneratorTarget;
   cmGeneratorTarget* GeneratorTarget;
   cmMakefile* Makefile;
   cmMakefile* Makefile;
+  cmLocalGenerator* LocalGenerator;
   cmGlobalGenerator const* GlobalGenerator;
   cmGlobalGenerator const* GlobalGenerator;
   typedef cmGeneratorTarget::SourceEntry SourceEntry;
   typedef cmGeneratorTarget::SourceEntry SourceEntry;
   SourceEntry* CurrentEntry;
   SourceEntry* CurrentEntry;
@@ -2146,11 +2146,12 @@ private:
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 cmTargetTraceDependencies
 cmTargetTraceDependencies
 ::cmTargetTraceDependencies(cmGeneratorTarget* target):
 ::cmTargetTraceDependencies(cmGeneratorTarget* target):
-  Target(target->Target), GeneratorTarget(target)
+  GeneratorTarget(target)
 {
 {
   // Convenience.
   // Convenience.
-  this->Makefile = this->Target->GetMakefile();
-  this->GlobalGenerator = target->GetLocalGenerator()->GetGlobalGenerator();
+  this->Makefile = target->Target->GetMakefile();
+  this->LocalGenerator = target->GetLocalGenerator();
+  this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
   this->CurrentEntry = 0;
   this->CurrentEntry = 0;
 
 
   // Queue all the source files already specified for the target.
   // Queue all the source files already specified for the target.
@@ -2193,9 +2194,12 @@ cmTargetTraceDependencies
     }
     }
 
 
   // Queue pre-build, pre-link, and post-build rule dependencies.
   // Queue pre-build, pre-link, and post-build rule dependencies.
-  this->CheckCustomCommands(this->Target->GetPreBuildCommands());
-  this->CheckCustomCommands(this->Target->GetPreLinkCommands());
-  this->CheckCustomCommands(this->Target->GetPostBuildCommands());
+  this->CheckCustomCommands(
+        this->GeneratorTarget->Target->GetPreBuildCommands());
+  this->CheckCustomCommands(
+        this->GeneratorTarget->Target->GetPreLinkCommands());
+  this->CheckCustomCommands(
+        this->GeneratorTarget->Target->GetPostBuildCommands());
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
@@ -2324,7 +2328,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
         tLocation = cmSystemTools::CollapseFullPath(tLocation);
         tLocation = cmSystemTools::CollapseFullPath(tLocation);
         if(depLocation == tLocation)
         if(depLocation == tLocation)
           {
           {
-          this->Target->AddUtility(util);
+          this->GeneratorTarget->Target->AddUtility(util);
           return true;
           return true;
           }
           }
         }
         }
@@ -2333,7 +2337,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
       {
       {
       // The original name of the dependency was not a full path.  It
       // The original name of the dependency was not a full path.  It
       // must name a target, so add the target-level dependency.
       // must name a target, so add the target-level dependency.
-      this->Target->AddUtility(util);
+      this->GeneratorTarget->Target->AddUtility(util);
       return true;
       return true;
       }
       }
     }
     }
@@ -2359,7 +2363,8 @@ cmTargetTraceDependencies
     {
     {
     std::string const& command = *cit->begin();
     std::string const& command = *cit->begin();
     // Check for a target with this name.
     // Check for a target with this name.
-    if(cmTarget* t = this->Makefile->FindTargetToUse(command))
+    if(cmGeneratorTarget* t =
+       this->LocalGenerator->FindGeneratorTargetToUse(command))
       {
       {
       if(t->GetType() == cmState::EXECUTABLE)
       if(t->GetType() == cmState::EXECUTABLE)
         {
         {
@@ -2367,7 +2372,7 @@ cmTargetTraceDependencies
         // this project.  Add the target-level dependency to make
         // this project.  Add the target-level dependency to make
         // sure the executable is up to date before this custom
         // sure the executable is up to date before this custom
         // command possibly runs.
         // command possibly runs.
-        this->Target->AddUtility(command);
+        this->GeneratorTarget->Target->AddUtility(command);
         }
         }
       }
       }
 
 
@@ -2386,7 +2391,7 @@ cmTargetTraceDependencies
   for(std::set<cmGeneratorTarget*>::iterator ti = targets.begin();
   for(std::set<cmGeneratorTarget*>::iterator ti = targets.begin();
       ti != targets.end(); ++ti)
       ti != targets.end(); ++ti)
     {
     {
-    this->Target->AddUtility((*ti)->GetName());
+    this->GeneratorTarget->Target->AddUtility((*ti)->GetName());
     }
     }
 
 
   // Queue the custom command dependencies.
   // Queue the custom command dependencies.