mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
VS: do not create ProgramDataBaseFileName entries without a filepath
The logic in commit f78f592b78 (pchreuse: defer target existence
enforcement to generation time, 2025-06-16, v4.2.0-rc1~481^2~4) caused
generator targets to always respond with something for compilation PDB
files. This may be a directory as the flag supports it (the then
compiler chooses the filename). However, one caller was expecting it to
always be a path to a file in order to specify the
`ProgramDataBaseFileName` element. However, this usage cannot be a
directory.
In addition to not having a PDB path at all, also verify that it is not
a path to a directory before creating the `ProgramDataBaseFileName`
element.
This was observed in builds using `import std` in Debug mode.
Fixes: #27320
This commit is contained in:
@@ -3765,7 +3765,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
|
||||
|
||||
// Specify the compiler program database file if configured.
|
||||
std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName);
|
||||
if (!pdb.empty()) {
|
||||
if (!pdb.empty() && !cmHasSuffix(pdb, '/') && !cmHasSuffix(pdb, '\\')) {
|
||||
if (this->GlobalGenerator->IsCudaEnabled()) {
|
||||
// CUDA does not quote paths with spaces correctly when forwarding
|
||||
// this to the host compiler. Use a relative path to avoid spaces.
|
||||
|
||||
Reference in New Issue
Block a user