Examples of modern Fortran 2008
submodule, using Meson or CMake.
Fortran submodules are a unique concept distinct from C++.
Fortran submodules allow easy switching in and out of features and extremely fast recompilation of large programs perhaps 100 times or more faster.
For example a program's file IO could use raw binary, HDF5, or NetCDF switched using Fortran submodule.
A simulation could have different proprietary or open source modules switched in and out via Fortran submodule.
In general, Fortran compilers have good submodule support. This includes gfortran, Intel ifort, nagfor, flang, PGI, IBM, Cray, etc.
Meson and CMake are two build systems that support Fortran submodule.
meson build meson test -C build
CMake >= 3.12 is required to use Fortran
NAG compiler requires CMake >= 3.16.3
cmake -B build cmake --build build --parallel cd build ctest -V
- Steve Lionel (Intel) submodule discussion