PCH+REUSE_FROM: Build hangs for 30 seconds in copy_idb_pdb.cmake if /Gm- is used
The handling of .idb files for MSVC is incorrect when precompiled headers and REUSE_FROM is used. I use cmake release 3.18.2. The project that generates the precompiled header uses toolset v90 (VS2008 toolset) and has Minimal Rebuild disabled (/Gm-), /Zi is enabled. In that case only a .pdb file but no .idb file will be generated. copy_idb_pdb.cmake still tries to copy the .idb file for 30 seconds before the build continues. There is a comment in cmLocalGenerator.cxx:
// MSVC 2008 is producing both .pdb and .idb files with /Zi.
I think this assumption is the source of the problem. It is not true if /Gm- is used, no .idb will be generated. In that case cmake should not try to copy the .idb file. As a workaround I placed an empty .idb next to the generated .pdb file. Then the build does not hang anymore.