Forráskód Böngészése

Move GetLocation to cmGeneratorTarget.

Stephen Kelly 12 éve
szülő
commit
9f2dca805c

+ 1 - 1
Source/cmCustomCommandGenerator.cxx

@@ -48,7 +48,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
      (target->Target->IsImported()
       || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")))
     {
-    return target->Target->GetLocation(this->Config);
+    return target->GetLocation(this->Config);
     }
   return this->GE->Parse(argv0)->Evaluate(this->LG->GetMakefile(),
                                           this->Config);

+ 1 - 1
Source/cmExtraCodeBlocksGenerator.cxx

@@ -593,7 +593,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
       {
       cmGeneratorTarget* gt =
           this->GlobalGenerator->GetGeneratorTarget(target);
-      location = gt->Target->GetLocation(buildType);
+      location = gt->GetLocation(buildType);
       }
 
     fout<<"         <Option output=\"" << location

+ 23 - 2
Source/cmGeneratorTarget.cxx

@@ -519,6 +519,26 @@ void cmGeneratorTarget
   srcs = data.XamlSources;
 }
 
+//----------------------------------------------------------------------------
+const char* cmGeneratorTarget::GetLocation(const std::string& config) const
+{
+  static std::string location;
+  if (this->Target->IsImported())
+    {
+    location = this->Target->ImportedGetFullPath(config, false);
+    }
+  else
+    {
+    location = this->Target->GetFullPath(config, false);
+    }
+  return location.c_str();
+}
+
+bool cmGeneratorTarget::IsImported() const
+{
+  return this->Target->IsImported();
+}
+
 //----------------------------------------------------------------------------
 bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
                                               const std::string& config) const
@@ -834,7 +854,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
     }
 
   // Check for a target with this name.
-  if(cmTarget* t = this->Makefile->FindTargetToUse(util))
+  if(cmGeneratorTarget* t
+                    = this->Makefile->FindGeneratorTargetToUse(util))
     {
     // If we find the target and the dep was given as a full path,
     // then make sure it was not a full path to something else, and
@@ -846,7 +867,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
         {
         // This is really only for compatibility so we do not need to
         // worry about configuration names and output names.
-        std::string tLocation = t->GetLocationForBuild();
+        std::string tLocation = t->Target->GetLocationForBuild();
         tLocation = cmSystemTools::GetFilenamePath(tLocation);
         std::string depLocation = cmSystemTools::GetFilenamePath(dep);
         depLocation = cmSystemTools::CollapseFullPath(depLocation);

+ 3 - 0
Source/cmGeneratorTarget.h

@@ -28,6 +28,9 @@ public:
 
   cmLocalGenerator* GetLocalGenerator() const;
 
+  bool IsImported() const;
+  const char *GetLocation(const std::string& config) const;
+
   int GetType() const;
   std::string GetName() const;
   const char *GetProperty(const std::string& prop) const;

+ 1 - 1
Source/cmGlobalKdevelopGenerator.cxx

@@ -76,7 +76,7 @@ void cmGlobalKdevelopGenerator::Generate()
         {
         if (ti->second->GetType()==cmTarget::EXECUTABLE)
           {
-          executable = ti->second->Target->GetLocation("");
+          executable = ti->second->GetLocation("");
           break;
           }
         }

+ 2 - 2
Source/cmLocalGenerator.cxx

@@ -1710,7 +1710,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
       if(target->GetType() >= cmTarget::EXECUTABLE &&
          target->GetType() <= cmTarget::MODULE_LIBRARY)
         {
-        tLocation = target->Target->GetLocation(config);
+        tLocation = target->GetLocation(config);
         tLocation = cmSystemTools::GetFilenamePath(tLocation);
         tLocation = cmSystemTools::CollapseFullPath(tLocation);
         }
@@ -1733,7 +1733,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
       case cmTarget::SHARED_LIBRARY:
       case cmTarget::MODULE_LIBRARY:
       case cmTarget::UNKNOWN_LIBRARY:
-        dep = target->Target->GetLocation(config);
+        dep = target->GetLocation(config);
         return true;
       case cmTarget::OBJECT_LIBRARY:
         // An object library has no single file on which to depend.

+ 0 - 15
Source/cmTarget.cxx

@@ -2738,21 +2738,6 @@ std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const
   return "";
 }
 
-//----------------------------------------------------------------------------
-const char* cmTarget::GetLocation(const std::string& config) const
-{
-  static std::string location;
-  if (this->IsImported())
-    {
-    location = this->ImportedGetFullPath(config, false);
-    }
-  else
-    {
-    location = this->GetFullPath(config, false);
-    }
-  return location.c_str();
-}
-
 //----------------------------------------------------------------------------
 const char* cmTarget::ImportedGetLocation(const std::string& config) const
 {

+ 0 - 3
Source/cmTarget.h

@@ -374,9 +374,6 @@ public:
       compiler pdb output directory is given.  */
   std::string GetCompilePDBDirectory(const std::string& config = "") const;
 
-  /** Get the location of the target in the build tree for the given
-      configuration.  */
-  const char* GetLocation(const std::string& config) const;
   const char* ImportedGetLocation(const std::string& config) const;
 
   /** Get the location of the target in the build tree with a placeholder