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
This commit is contained in:
Brad King
2016-11-30 10:20:52 -05:00
parent afe7d5f26d
commit a4da6fa71d
2 changed files with 14 additions and 0 deletions

View File

@@ -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";
}
}
}

View File

@@ -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";
}
}
}