Browse Source

cmGeneratorTarget: Move GetCompilePDBDirectory from cmTarget.

Stephen Kelly 10 years ago
parent
commit
b3f0e35308

+ 11 - 1
Source/cmGeneratorTarget.cxx

@@ -743,7 +743,7 @@ cmGeneratorTarget::GetCompilePDBName(const std::string& config) const
 std::string
 cmGeneratorTarget::GetCompilePDBPath(const std::string& config) const
 {
-  std::string dir = this->Target->GetCompilePDBDirectory(config);
+  std::string dir = this->GetCompilePDBDirectory(config);
   std::string name = this->GetCompilePDBName(config);
   if(dir.empty() && !name.empty())
     {
@@ -1824,6 +1824,16 @@ void cmGeneratorTarget::TraceDependencies()
   tracer.Trace();
 }
 
+std::string
+cmGeneratorTarget::GetCompilePDBDirectory(const std::string& config) const
+{
+  if(cmTarget::CompileInfo const* info = this->Target->GetCompileInfo(config))
+    {
+    return info->CompilePdbDir;
+    }
+  return "";
+}
+
 //----------------------------------------------------------------------------
 void cmGeneratorTarget::GetAppleArchs(const std::string& config,
                              std::vector<std::string>& archVec) const

+ 6 - 0
Source/cmGeneratorTarget.h

@@ -214,6 +214,12 @@ public:
    */
   void TraceDependencies();
 
+  /** Get the directory in which to place the target compiler .pdb file.
+      If the configuration name is given then the generator will add its
+      subdirectory for that configuration.  Otherwise just the canonical
+      compiler pdb output directory is given.  */
+  std::string GetCompilePDBDirectory(const std::string& config = "") const;
+
   /** Get sources that must be built before the given source.  */
   std::vector<cmSourceFile*> const*
   GetSourceDepends(cmSourceFile const* sf) const;

+ 1 - 1
Source/cmMakefileExecutableTargetGenerator.cxx

@@ -130,7 +130,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     }
 
   std::string compilePdbOutputPath =
-    this->Target->GetCompilePDBDirectory(this->ConfigName);
+    this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
   cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
 
   std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName);

+ 1 - 1
Source/cmMakefileLibraryTargetGenerator.cxx

@@ -311,7 +311,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
     }
 
   std::string compilePdbOutputPath =
-    this->Target->GetCompilePDBDirectory(this->ConfigName);
+    this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
   cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
 
   std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName);

+ 0 - 16
Source/cmTarget.cxx

@@ -68,12 +68,6 @@ struct cmTarget::OutputInfo
   std::string PdbDir;
 };
 
-//----------------------------------------------------------------------------
-struct cmTarget::CompileInfo
-{
-  std::string CompilePdbDir;
-};
-
 //----------------------------------------------------------------------------
 class cmTargetInternals
 {
@@ -2672,16 +2666,6 @@ std::string cmTarget::GetPDBDirectory(const std::string& config) const
   return "";
 }
 
-//----------------------------------------------------------------------------
-std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const
-{
-  if(CompileInfo const* info = this->GetCompileInfo(config))
-    {
-    return info->CompilePdbDir;
-    }
-  return "";
-}
-
 //----------------------------------------------------------------------------
 const char* cmTarget::ImportedGetLocation(const std::string& config) const
 {

+ 5 - 7
Source/cmTarget.h

@@ -334,12 +334,6 @@ public:
       pdb output directory is given.  */
   std::string GetPDBDirectory(const std::string& config) const;
 
-  /** Get the directory in which to place the target compiler .pdb file.
-      If the configuration name is given then the generator will add its
-      subdirectory for that configuration.  Otherwise just the canonical
-      compiler pdb output directory is given.  */
-  std::string GetCompilePDBDirectory(const std::string& config = "") const;
-
   const char* ImportedGetLocation(const std::string& config) const;
 
   /** Get the target major and minor version numbers interpreted from
@@ -633,7 +627,11 @@ private:
                          ImportInfo& info) const;
 
   // Cache target compile paths for each configuration.
-  struct CompileInfo;
+  struct CompileInfo
+  {
+    std::string CompilePdbDir;
+  };
+
   CompileInfo const* GetCompileInfo(const std::string& config) const;
 
   LinkInterface const*