Fortran submodule support across compilers
Fortran submodule
support is highly welcomed and necessary in CMake.
However, at the moment submodule
doesn't work for some popular Fortran compilers:
- works: Gfortran, Intel ifort
- broken: Flang, PGI, IBM XL
submodule interface file naming conventions
The CMake source in several places depends on the de facto file naming practices of gfortran and ifort.
Unfortunately PGI, Flang and IBM XL chose a different file naming practice.
Here is a table of the file naming conventions for a two-file program with module demo
and submodule hi
in separate files:
Compiler | module files | submodule files |
---|---|---|
gfortran |
demo.mod demo.smod |
demo@hi.smod |
flang |
demo.mod |
demo-hi.mod |
pgf90 |
demo.mod |
demo-hi.mod |
ifort |
demo.mod |
demo@hi.smod |
xlf2008 |
demo.mod |
demo_hi.smod |
ftn (Cray) |
DEMO.mod |
HI.mod |
Cray need to use ftn -em
to expose the .mod files in the filesystem.
CMake source files needing modification
A quick grep
indicates that at least this C++ code may need modification to support Fortran submodule
across compilers:
- Source/cmFortranParserImpl.cxx
- Source/cmDependsFortran.cxx
What to do?
I would need guidance from the maintainers as if/how to indicate which compiler is being used, to generalize the behavior of the C++ code above.