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::CopyPchCompilePdbis broken in multiple places. The
configGenexlambda tests to see if the generator is Visual Studio specifically rather than a multi-config generator when deciding whether or not to insert
The foreach loop in the generated
copy_idb_pdb.cmakescript 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: