summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-12-15 21:15:28 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-15 21:20:21 (GMT)
commit6271df8ff5ce5552929bb76440fa432641498800 (patch)
tree88bf43220618c502161104708b96cbe0ef26410c /Source/cmCommonTargetGenerator.cxx
parent59461c2696e46f5d3eaf5753ee4f7d2ee6eb71a6 (diff)
downloadCMake-6271df8ff5ce5552929bb76440fa432641498800.zip
CMake-6271df8ff5ce5552929bb76440fa432641498800.tar.gz
CMake-6271df8ff5ce5552929bb76440fa432641498800.tar.bz2
Makefile,Ninja: De-duplicate MSVC compiler PDB path selection
Add a helper to cmCommonTargetGenerator instead of duplicating it in cmMakefileTargetGenerator and cmNinjaTargetGenerator.
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index c3a925f..7e113ab 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -184,6 +184,28 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories()
return dirs;
}
+std::string cmCommonTargetGenerator::ComputeTargetCompilePDB() const
+{
+ std::string compilePdbPath;
+ if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) {
+ return compilePdbPath;
+ }
+ compilePdbPath =
+ this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName());
+ if (compilePdbPath.empty()) {
+ // Match VS default: `$(IntDir)vc$(PlatformToolsetVersion).pdb`.
+ // A trailing slash tells the toolchain to add its default file name.
+ compilePdbPath = this->GeneratorTarget->GetSupportDirectory() + "/";
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
+ // Match VS default for static libs: `$(IntDir)$(ProjectName).pdb`.
+ compilePdbPath += this->GeneratorTarget->GetName();
+ compilePdbPath += ".pdb";
+ }
+ }
+
+ return compilePdbPath;
+}
+
std::string cmCommonTargetGenerator::GetManifests()
{
std::vector<cmSourceFile const*> manifest_srcs;