Spurious dumpbin crashes (race-conflicts?) in `file(GET_RUNTIME_DEPENDENCIES`

We are using file(GET_RUNTIME_DEPENDENCIES as a POST_BUILD step in many targets
on Windows to copy DLLs next to the executable for debugging purposes (also .pdbs etc…). So far this procedure is exactly the same on all platforms as during install which is great.

The function file(GET_RUNTIME_DEPENDENCIES is only supposed to be used in install steps as far as the documentation states.

However, for the POST_BUILD, we are experiencing some strange dumpbin.exe crashes which
occur to be related to the speed of the machine, and also after some multiple cmake --build invocations the build succeeds.

We would be really interessted why this happens and if it could be potentially be fixed by CMake or if it is really the case that we should not use this function during POST_BUILD.

Thanks for your input.

Can you provide a small example that shows the problem? Or at least provide more details about the error messages and/or symptoms.

It sounds like dumpbin itself is crashing…not sure what CMake can do about that.

Cc: @kyle.edwards

I think we located the problem, we do also copy after the deps. sweep, and since we have multiple targets setting up this post build it results in a race condition since the deps sweep also looks into the build folder where it will also copy dlls at the end.and multiple of these procedure in paralle is doomed to fail.