Ninja generator dependency cycle with Fortran [OBJECT_OUTPUTS/OBJECT_DEPENDS]
I am attempting to bootstrap flang using the Ninja generator. It works except for one issue that I haven't been able to find a solution for. When compiling a particular object file, flang produces a byproduct which is needed for compiling other object files. For the makefile generator, this is expressed as such:
# State the module that the source is producing
# State a dependency on the module
The problem is that this is a direct cause of the following error:
ninja: error: dependency cycle: runtime/flang/CMakeFiles/flang_static.dir/Fortran.dd -> runtime/flang/CMakeFiles/flang_static.dir/ieee_arithmetic.F95-pp.f95.ddi -> runtime/flang/iso_c_binding.mod -> runtime/flang/CMakeFiles/flang_static.dir/iso_c_bind.F95.obj -> runtime/flang/CMakeFiles/flang_static.dir/Fortran.dd
The only way that I have found around this that doesn't cause race conditions is to link a library that contains that one file and make it a dependency of other libraries including those sources. It probably extends the build time by a few seconds, so it is not the end of the world, but I think this is probably a bug in the ninja generator.