summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-30 15:20:52 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-30 15:26:31 (GMT)
commita4da6fa71dc0e0e6102d4b72f7abee00ac4e4110 (patch)
treeb40de333991ed1aaa1936f52e8aed7d8483f9ff8
parentafe7d5f26d16a76d26ac361d7a41a5119d20dd11 (diff)
downloadCMake-a4da6fa71dc0e0e6102d4b72f7abee00ac4e4110.zip
CMake-a4da6fa71dc0e0e6102d4b72f7abee00ac4e4110.tar.gz
CMake-a4da6fa71dc0e0e6102d4b72f7abee00ac4e4110.tar.bz2
Ninja,Makefile: Name static library compile PDB files as VS does
Change the default compile PDB file name for static libraries to match the Visual Studio default of using the logical target name. This may be incompatible with existing behavior but `COMPILE_PDB_NAME` documents that the default is unspecified. Projects depending on a particular name should set the property. Closes: #16438
-rw-r--r--Source/cmMakefileTargetGenerator.cxx7
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
2 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2e5173d..6906a90 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -520,8 +520,15 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
targetFullPathCompilePDB =
this->GeneratorTarget->GetCompilePDBPath(this->ConfigName);
if (targetFullPathCompilePDB.empty()) {
+ // Match VS default: `$(IntDir)vc$(PlatformToolsetVersion).pdb`.
+ // A trailing slash tells the toolchain to add its default file name.
targetFullPathCompilePDB =
this->GeneratorTarget->GetSupportDirectory() + "/";
+ if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
+ // Match VS default for static libs: `$(IntDir)$(ProjectName).pdb`.
+ targetFullPathCompilePDB += this->GeneratorTarget->GetName();
+ targetFullPathCompilePDB += ".pdb";
+ }
}
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index e47de97..8090542 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -359,7 +359,14 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
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";
+ }
}
}