I notice that CheckCXXSourceRuns uses
file(WRITE ...) to generate a source file, and then uses
try_compile to build the freshly generated source.
It is my (possibly wrong?) understanding that there is no explicit dependency between the code generated by
file(WRITE ...) and the
try_compile command, so that the
try_compile may occur before the
file(WRITE ... succeeds in a massively parallel build.
I ran into this exact error not in
CheckCXXSourceRuns, but in nearly identical code modeled after the function, on a 40 core machine using Ninja as the generator.
Is there indeed a race condition here, or am I off the mark?