Ninja Multi-Config produces invalid copy_idb_pdb.cmake scripts
Discovered while investigating #21973 (closed) -- building a Windows project with Ninja Multi-Config calls a generated copy_idb_pdb.cmake
script during the build. I do not know CMake's internals well enough to find a minimal test case, sorry.
Here's what I could find (quoting myself from the other issue):
void cmLocalGenerator::CopyPchCompilePdb
is broken in multiple places. TheconfigGenex
lambda tests to see if the generator is Visual Studio specifically rather than a multi-config generator when deciding whether or not to insert$<CONFIG:...>
.The foreach loop in the generated
copy_idb_pdb.cmake
script is running out of its 30 retries (each of which take 1 second) and there's no code after the 30th retry to make the build fail with an internal error.
These are the code segments that seem to be the culprits:
https://gitlab.kitware.com/cmake/cmake/-/blob/v3.20.0/Source/cmLocalGenerator.cxx#L2703-2724
https://gitlab.kitware.com/cmake/cmake/-/blob/v3.20.0/Source/cmLocalGenerator.cxx#L2729-2739