From 50dc9b44404f4f31aa24cf17247f10539c3807b2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 5 Aug 2015 18:39:17 +0200 Subject: [PATCH] cmGeneratorTarget: Move GetPDBDirectory from cmTarget. --- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmGeneratorTarget.cxx | 14 +++++++++++++- Source/cmGeneratorTarget.h | 6 ++++++ Source/cmLocalVisualStudio7Generator.cxx | 4 ++-- Source/cmMakefileExecutableTargetGenerator.cxx | 3 ++- Source/cmMakefileLibraryTargetGenerator.cxx | 3 ++- Source/cmMakefileTargetGenerator.cxx | 3 ++- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 11 ----------- Source/cmTarget.h | 6 ------ Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 11 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 961705f98..fdacc82ed 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1631,7 +1631,7 @@ struct TargetFilesystemArtifactResultCreator return std::string(); } - std::string result = target->Target->GetPDBDirectory(context->Config); + std::string result = target->GetPDBDirectory(context->Config); result += "/"; result += target->GetPDBName(context->Config); return result; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b8a87a271..a2423cc57 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1130,7 +1130,7 @@ cmGeneratorTarget::GetCompilePDBPath(const std::string& config) const std::string name = this->GetCompilePDBName(config); if(dir.empty() && !name.empty()) { - dir = this->Target->GetPDBDirectory(config); + dir = this->GetPDBDirectory(config); } if(!dir.empty()) { @@ -4995,3 +4995,15 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( } } } + +//---------------------------------------------------------------------------- +std::string +cmGeneratorTarget::GetPDBDirectory(const std::string& config) const +{ + if(cmTarget::OutputInfo const* info = this->Target->GetOutputInfo(config)) + { + // Return the directory in which the target will be built. + return info->PdbDir; + } + return ""; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 43b792203..b39ba9fc0 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -359,6 +359,12 @@ public: /** Return true if builtin chrpath will work for this target */ bool IsChrpathUsed(const std::string& config) const; + /** Get the directory in which this targets .pdb files will be placed. + If the configuration name is given then the generator will add its + subdirectory for that configuration. Otherwise just the canonical + pdb output directory is given. */ + std::string GetPDBDirectory(const std::string& config) const; + ///! Return the preferred linker language for this target std::string GetLinkerLanguage(const std::string& config = "") const; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index e7fe61e2b..e3c28ee92 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1220,7 +1220,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\t\tAdditionalLibraryDirectories=\""; this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; - temp = target.GetPDBDirectory(configName); + temp = gt->GetPDBDirectory(configName); temp += "/"; temp += targetNamePDB; fout << "\t\t\t\tProgramDatabaseFile=\"" << @@ -1320,7 +1320,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->OutputLibraryDirectories(fout, cli.GetDirectories()); fout << "\"\n"; std::string path = this->ConvertToXMLOutputPathSingle( - target.GetPDBDirectory(configName).c_str()); + gt->GetPDBDirectory(configName).c_str()); fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/" << targetNamePDB << "\"\n"; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index eebee83a4..f6b907e24 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -133,7 +133,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); - std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); + std::string pdbOutputPath = + this->GeneratorTarget->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d12142a00..3b3f63e2d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -314,7 +314,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); - std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); + std::string pdbOutputPath = + this->GeneratorTarget->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index cd499f685..6eafeae31 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -546,7 +546,8 @@ cmMakefileTargetGenerator { targetFullPathReal = this->GeneratorTarget->GetFullPath(this->ConfigName, false, true); - targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName); + targetFullPathPDB = + this->GeneratorTarget->GetPDBDirectory(this->ConfigName); targetFullPathPDB += "/"; targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 33e08a3f8..c2daa6309 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -289,7 +289,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const this->Target->GetType() == cmTarget::SHARED_LIBRARY || this->Target->GetType() == cmTarget::MODULE_LIBRARY) { - pdbPath = this->Target->GetPDBDirectory(this->GetConfigName()); + pdbPath = this->GeneratorTarget->GetPDBDirectory(this->GetConfigName()); pdbPath += "/"; pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName()); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0f8b3b074..0fc0423a5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1770,17 +1770,6 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo( return &i->second; } -//---------------------------------------------------------------------------- -std::string cmTarget::GetPDBDirectory(const std::string& config) const -{ - if(OutputInfo const* info = this->GetOutputInfo(config)) - { - // Return the directory in which the target will be built. - return info->PdbDir; - } - return ""; -} - //---------------------------------------------------------------------------- const char* cmTarget::ImportedGetLocation(const std::string& config) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 507ea7db9..2f9a94b0a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -231,12 +231,6 @@ public: the link dependencies of this target. */ std::string CheckCMP0004(std::string const& item) const; - /** Get the directory in which this targets .pdb files will be placed. - If the configuration name is given then the generator will add its - subdirectory for that configuration. Otherwise just the canonical - pdb output directory is given. */ - std::string GetPDBDirectory(const std::string& config) const; - const char* ImportedGetLocation(const std::string& config) const; /** Get the target major and minor version numbers interpreted from diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4c9b82b50..a4b0bc365 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2581,7 +2581,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) { linkOptions.AddFlag("GenerateDebugInformation", "false"); } - std::string pdb = this->Target->GetPDBDirectory(config.c_str()); + std::string pdb = this->GeneratorTarget->GetPDBDirectory(config.c_str()); pdb += "/"; pdb += targetNamePDB; std::string imLib =