Browse Source

cmGeneratorTarget: Move GetPDBName from cmTarget.

Stephen Kelly 10 years ago
parent
commit
3df705681b

+ 1 - 1
Source/cmGeneratorExpressionNode.cxx

@@ -1625,7 +1625,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
 
     std::string result = target->Target->GetPDBDirectory(context->Config);
     result += "/";
-    result += target->Target->GetPDBName(context->Config);
+    result += target->GetPDBName(context->Config);
     return result;
   }
 };

+ 34 - 2
Source/cmGeneratorTarget.cxx

@@ -1525,7 +1525,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
     }
 
   // The program database file name.
-  pdbName = this->Target->GetPDBName(config);
+  pdbName = this->GetPDBName(config);
 }
 
 //----------------------------------------------------------------------------
@@ -1587,7 +1587,39 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
   impName = this->Target->GetFullNameInternal(config, true);
 
   // The program database file name.
-  pdbName = this->Target->GetPDBName(config);
+  pdbName = this->GetPDBName(config);
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetPDBName(const std::string& config) const
+{
+  std::string prefix;
+  std::string base;
+  std::string suffix;
+  this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
+
+  std::vector<std::string> props;
+  std::string configUpper =
+    cmSystemTools::UpperCase(config);
+  if(!configUpper.empty())
+    {
+    // PDB_NAME_<CONFIG>
+    props.push_back("PDB_NAME_" + configUpper);
+    }
+
+  // PDB_NAME
+  props.push_back("PDB_NAME");
+
+  for(std::vector<std::string>::const_iterator i = props.begin();
+      i != props.end(); ++i)
+    {
+    if(const char* outName = this->GetProperty(*i))
+      {
+      base = outName;
+      break;
+      }
+    }
+  return prefix+base+".pdb";
 }
 
 bool cmStrictTargetComparison::operator()(cmTarget const* t1,

+ 3 - 0
Source/cmGeneratorTarget.h

@@ -160,6 +160,9 @@ public:
   std::vector<cmSourceFile*> const*
   GetSourceDepends(cmSourceFile const* sf) const;
 
+  /** Get the name of the pdb file for the target.  */
+  std::string GetPDBName(const std::string& config="") const;
+
   /** Whether this library has soname enabled and platform supports it.  */
   bool HasSOName(const std::string& config) const;
 

+ 1 - 1
Source/cmMakefileTargetGenerator.cxx

@@ -548,7 +548,7 @@ cmMakefileTargetGenerator
       this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
     targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
     targetFullPathPDB += "/";
-    targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
+    targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName);
     }
   if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
     {

+ 1 - 1
Source/cmNinjaTargetGenerator.cxx

@@ -273,7 +273,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
       {
       pdbPath = this->Target->GetPDBDirectory(this->GetConfigName());
       pdbPath += "/";
-      pdbPath += this->Target->GetPDBName(this->GetConfigName());
+      pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName());
       }
     if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
       {

+ 0 - 31
Source/cmTarget.cxx

@@ -3460,37 +3460,6 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
   return "";
 }
 
-//----------------------------------------------------------------------------
-std::string cmTarget::GetPDBName(const std::string& config) const
-{
-  std::string prefix;
-  std::string base;
-  std::string suffix;
-  this->GetFullNameInternal(config, false, prefix, base, suffix);
-
-  std::vector<std::string> props;
-  std::string configUpper = cmSystemTools::UpperCase(config);
-  if(!configUpper.empty())
-    {
-    // PDB_NAME_<CONFIG>
-    props.push_back("PDB_NAME_" + configUpper);
-    }
-
-  // PDB_NAME
-  props.push_back("PDB_NAME");
-
-  for(std::vector<std::string>::const_iterator i = props.begin();
-      i != props.end(); ++i)
-    {
-    if(const char* outName = this->GetProperty(*i))
-      {
-      base = outName;
-      break;
-      }
-    }
-  return prefix+base+".pdb";
-}
-
 //----------------------------------------------------------------------------
 bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
 {

+ 0 - 3
Source/cmTarget.h

@@ -377,9 +377,6 @@ public:
                              const std::string& config="",
                              bool implib = false) const;
 
-  /** Get the name of the pdb file for the target.  */
-  std::string GetPDBName(const std::string& config) const;
-
   /** Whether this library has \@rpath and platform supports it.  */
   bool HasMacOSXRpathInstallNameDir(const std::string& config) const;