I discovered an odd failure while attempting to port a large (mostly-)Fortran project to cmake+ninja under Msys2.
The failure is clearly in the Fortran source code parser attempting to search for "module" statements, which misfires on the line in my codebase:
call io_abort("Error in "//subroutine_name//": attempting to initialise ion_ion &
&module when module has already been initialised.")
The parser erroneously imagines it spots the start of a new module, failing to notice that the text "module when" is part of a quoted string, continued from the previous line. This generates a .ddi file containing
"provides" :
[
{
"compiled-module-path" : "mod/ion_ion.mod",
"logical-name" : "ion_ion.mod"
}
{
"compiled-module-path" : "mod/when.mod",
"logical-name" : "when.mod"
}
],
and ultimately leads to an aborted build with
ninja: build stopped: multiple rules generate mod/when.mod.
This failure occurs in msys2/ucrt64 on Windows 10 with cmake 2.24.2 and ninja 1.11.1. I have attempted to reproduce this under linux with the same versions of cmake and ninja, but on that platform the error does not occur. I am very new to ninja, and I hope I have it write that the dependency generation is part of ninja and not cmake.
I wonder if the failure to detect a continued quoted string might be due to some issue with regexp matching and windows like endings? Any thoughts/suggestions welcome.