From 9f2dca805c8010636d4be7ef03d96bfc131c9809 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Mon, 28 Oct 2013 19:47:46 +0100
Subject: Move GetLocation to cmGeneratorTarget.

---
 Source/cmCustomCommandGenerator.cxx   |  2 +-
 Source/cmExtraCodeBlocksGenerator.cxx |  2 +-
 Source/cmGeneratorTarget.cxx          | 25 +++++++++++++++++++++++--
 Source/cmGeneratorTarget.h            |  3 +++
 Source/cmGlobalKdevelopGenerator.cxx  |  2 +-
 Source/cmLocalGenerator.cxx           |  4 ++--
 Source/cmTarget.cxx                   | 15 ---------------
 Source/cmTarget.h                     |  3 ---
 8 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 086c9f9..7f3b651 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/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);
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 6d145a2..933a256 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/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
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index dc5a2a1..9fe7922 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -520,6 +520,26 @@ void cmGeneratorTarget
 }
 
 //----------------------------------------------------------------------------
+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);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 675ee9f..060007f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/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;
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 6611c74..138ddbb 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/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;
           }
         }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d6c8bae..2e20ee2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/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.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e4cd4f3..9122daf 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2739,21 +2739,6 @@ std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const
 }
 
 //----------------------------------------------------------------------------
-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
 {
   static std::string location;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a0198e2..4d419ee 100644
--- a/Source/cmTarget.h
+++ b/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
-- 
cgit v0.12