From f83e84028ac28ce098ea76bd857ae1663c295494 Mon Sep 17 00:00:00 2001
From: Stephen Kelly <steveire@gmail.com>
Date: Tue, 4 Aug 2015 19:19:51 +0200
Subject: cmGeneratorTarget: Move CompileInfoMap from cmTarget.

---
 Source/cmGeneratorTarget.cxx | 42 +++++++++++++++++++++++++++++++++++++++++-
 Source/cmGeneratorTarget.h   | 10 ++++++++++
 Source/cmTarget.cxx          | 42 ------------------------------------------
 Source/cmTarget.h            |  7 -------
 4 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index c6f248c..c831704 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1356,6 +1356,46 @@ cmGeneratorTarget::GetMacContentDirectory(const std::string& config,
   return fpath;
 }
 
+
+//----------------------------------------------------------------------------
+cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
+                                            const std::string& config) const
+{
+  // There is no compile information for imported targets.
+  if(this->IsImported())
+    {
+    return 0;
+    }
+
+  if(this->GetType() > cmTarget::OBJECT_LIBRARY)
+    {
+    std::string msg = "cmTarget::GetCompileInfo called for ";
+    msg += this->GetName();
+    msg += " which has type ";
+    msg += cmTarget::GetTargetTypeName(this->Target->GetType());
+    this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg);
+    return 0;
+    }
+
+  // Lookup/compute/cache the compile information for this configuration.
+  std::string config_upper;
+  if(!config.empty())
+    {
+    config_upper = cmSystemTools::UpperCase(config);
+    }
+  CompileInfoMapType::const_iterator i =
+    this->CompileInfoMap.find(config_upper);
+  if(i == this->CompileInfoMap.end())
+    {
+    CompileInfo info;
+    this->Target
+        ->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
+    CompileInfoMapType::value_type entry(config_upper, info);
+    i = this->CompileInfoMap.insert(entry).first;
+    }
+  return &i->second;
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
@@ -1827,7 +1867,7 @@ void cmGeneratorTarget::TraceDependencies()
 std::string
 cmGeneratorTarget::GetCompilePDBDirectory(const std::string& config) const
 {
-  if(cmTarget::CompileInfo const* info = this->Target->GetCompileInfo(config))
+  if(CompileInfo const* info = this->GetCompileInfo(config))
     {
     return info->CompilePdbDir;
     }
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 3dbbca1..68e7a8a 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -230,6 +230,16 @@ public:
   /** Whether this library has soname enabled and platform supports it.  */
   bool HasSOName(const std::string& config) const;
 
+  struct CompileInfo
+  {
+    std::string CompilePdbDir;
+  };
+
+  CompileInfo const* GetCompileInfo(const std::string& config) const;
+
+  typedef std::map<std::string, CompileInfo> CompileInfoMapType;
+  mutable CompileInfoMapType CompileInfoMap;
+
   /** Get the name of the compiler pdb file for the target.  */
   std::string GetCompilePDBName(const std::string& config="") const;
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9308113..1f8f07a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -126,9 +126,6 @@ public:
   typedef std::map<std::string, cmTarget::ImportInfo> ImportInfoMapType;
   ImportInfoMapType ImportInfoMap;
 
-  typedef std::map<std::string, cmTarget::CompileInfo> CompileInfoMapType;
-  CompileInfoMapType CompileInfoMap;
-
   // Cache link implementation computation from each configuration.
   struct OptionalLinkImplementation: public cmTarget::LinkImplementation
   {
@@ -2598,45 +2595,6 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(
 }
 
 //----------------------------------------------------------------------------
-cmTarget::CompileInfo const* cmTarget::GetCompileInfo(
-                                            const std::string& config) const
-{
-  // There is no compile information for imported targets.
-  if(this->IsImported())
-    {
-    return 0;
-    }
-
-  if(this->GetType() > cmTarget::OBJECT_LIBRARY)
-    {
-    std::string msg = "cmTarget::GetCompileInfo called for ";
-    msg += this->GetName();
-    msg += " which has type ";
-    msg += cmTarget::GetTargetTypeName(this->GetType());
-    this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg);
-    return 0;
-    }
-
-  // Lookup/compute/cache the compile information for this configuration.
-  std::string config_upper;
-  if(!config.empty())
-    {
-    config_upper = cmSystemTools::UpperCase(config);
-    }
-  typedef cmTargetInternals::CompileInfoMapType CompileInfoMapType;
-  CompileInfoMapType::const_iterator i =
-    this->Internal->CompileInfoMap.find(config_upper);
-  if(i == this->Internal->CompileInfoMap.end())
-    {
-    CompileInfo info;
-    this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
-    CompileInfoMapType::value_type entry(config_upper, info);
-    i = this->Internal->CompileInfoMap.insert(entry).first;
-    }
-  return &i->second;
-}
-
-//----------------------------------------------------------------------------
 std::string cmTarget::GetDirectory(const std::string& config,
                                    bool implib) const
 {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 8689838..e3fbdfd 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -626,13 +626,6 @@ private:
   void ComputeImportInfo(std::string const& desired_config,
                          ImportInfo& info) const;
 
-  // Cache target compile paths for each configuration.
-  struct CompileInfo
-  {
-    std::string CompilePdbDir;
-  };
-
-  CompileInfo const* GetCompileInfo(const std::string& config) const;
 
   LinkInterface const*
     GetImportLinkInterface(const std::string& config, cmTarget const* head,
-- 
cgit v0.12