From 3df705681be123d93146156fec3166b41b19465a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 4 Aug 2015 19:19:46 +0200 Subject: [PATCH] cmGeneratorTarget: Move GetPDBName from cmTarget. --- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmGeneratorTarget.cxx | 36 ++++++++++++++++++++++++++-- Source/cmGeneratorTarget.h | 3 +++ Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 31 ------------------------ Source/cmTarget.h | 3 --- 7 files changed, 40 insertions(+), 39 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index a20579bb0..49fc96ba7 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1625,7 +1625,7 @@ struct TargetFilesystemArtifactResultCreator std::string result = target->Target->GetPDBDirectory(context->Config); result += "/"; - result += target->Target->GetPDBName(context->Config); + result += target->GetPDBName(context->Config); return result; } }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a125e474d..a29f4c95a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/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 props; + std::string configUpper = + cmSystemTools::UpperCase(config); + if(!configUpper.empty()) + { + // PDB_NAME_ + props.push_back("PDB_NAME_" + configUpper); + } + + // PDB_NAME + props.push_back("PDB_NAME"); + + for(std::vector::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, diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 9cdfd0080..441bbcf3b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -160,6 +160,9 @@ public: std::vector 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; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f9125fc34..b94e151e7 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/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) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index e61ba6fe1..16e1f4813 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/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) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 188ad0f25..1e7fb5a9e 100644 --- a/Source/cmTarget.cxx +++ b/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 props; - std::string configUpper = cmSystemTools::UpperCase(config); - if(!configUpper.empty()) - { - // PDB_NAME_ - props.push_back("PDB_NAME_" + configUpper); - } - - // PDB_NAME - props.push_back("PDB_NAME"); - - for(std::vector::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 { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 162033cb5..8c2337249 100644 --- a/Source/cmTarget.h +++ b/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;