Fortran build systems

We build all our Fortran projects using the CMake build system. We are increasingly using Meson as well as CMake as Fortran support in Meson is growing rapidly (due in part to our code contributions). The most important aspects of a build system are generation speed and build speed.

Generation speed

Regardless of team size, for non-trivial projects in any compiled language, build speed can be a significant pain point. Even for medium projects, the seconds lost repeatedly building add up lost productivity for developers.

In this regard, CMake and Meson are among the fastest generators, while SCons and Autotools are among the slowest.

Build speed

Ninja is known to be generally faster than GNU Make, particularly for the case where only a few out of very many files need to be rebuilt. This is the usual case for developers. So as long as the generator works with Ninja, you can get fast builds.

Meson generates Ninja build files. Meson 0.50 massively increased support for Fortran compilers and features, so check out Meson again if it didn’t work for you on Fortran previously.

using Meson vs. CMake

Meson is a Python program without external dependencies. It’s easy to run the latest development snapshot or track Git changes as a result.

git clone
cd meson
pip install -e .

Since Meson generates Ninja build files, you will need to download Ninja. With Meson, the code build process goes like:

meson build

ninja -C build

while with CMake the code build is like:

cmake -B build
cmake --build build --parallel