CMake is interesting if you want to distribute your projects on various systems. It will for example detect if there is a Fortran compiler installed. It’s a very powerful tool.
If you don’t want to use the default compiler (f95 link on a Linux system), you can easily tell CMake which compiler you want, for example:
$ cmake -D CMAKE_Fortran_COMPILER:FILEPATH="/opt/intel/bin/ifort" ..
$ cmake -D CMAKE_Fortran_COMPILER:FILEPATH=$(which gfortran-9) ..
As you can see, a default of CMake, in my opinion, is that it is quite verbose…
Default build type is release, but you can override it:
$ cmake -D CMAKE_BUILD_TYPE=debug ..
In that file, you will find how to use some other variables, like CMAKE_Fortran_FLAGS_DEBUG
:
https://github.com/vmagnin/gtk-fortran/blob/gtk4/CMakeLists.txt
Meson is easier to use, but does not yet manage correctly the installation of Fortran mod files:
And of course, there is now fpm…