I can see how that might be an advantage but my experience is that CMake doesn’t always detect the installed compiler correctly. In my current setup I just use
make intel=t
since there are different options for different compilers.
The requirement for another tool in the toolchain needs justification (since it’s another point of failure). And it isn’t only Fortran that is problematic.
Last year I tried building covid-sim (from github) which is a C++ project. I tried again this afternoon and it still fails:
[simon@localhost build (master)]$ make -C …
make: Entering directory ‘/home/simon/development/projects/c19/covid-sim’
make[1]: Entering directory ‘/home/simon/development/projects/c19/covid-sim’
make[2]: Entering directory ‘/home/simon/development/projects/c19/covid-sim’
make[2]: Leaving directory ‘/home/simon/development/projects/c19/covid-sim’
make[2]: Entering directory ‘/home/simon/development/projects/c19/covid-sim’
[ 4%] Building CXX object Geometry/CMakeFiles/geometrylib.dir/Vector2.o
/home/simon/development/projects/c19/covid-sim/src/Geometry/Vector2.cpp:1:10: fatal error: geometry/Vector2.h: No such file or directory
#include “geometry/Vector2.h”
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Geometry/CMakeFiles/geometrylib.dir/build.make:63: Geometry/CMakeFiles/geometrylib.dir/Vector2.o] Error 1
make[2]: Leaving directory ‘/home/simon/development/projects/c19/covid-sim’
make[1]: *** [CMakeFiles/Makefile2:128: Geometry/CMakeFiles/geometrylib.dir/all] Error 2
make[1]: Leaving directory ‘/home/simon/development/projects/c19/covid-sim’
make: *** [Makefile:84: all] Error 2
make: Leaving directory ‘/home/simon/development/projects/c19/covid-sim’
No doubt the mistake is mine but the point is that this is really obscure and yet it is easy to build this program on the command line. It’s also easy to create a makefile with all the correct dependencies, and it is also easy to write a bash script that will create such a makefile.
I don’t agree that makefiles are just okay for small projects. My experience is that they’re good for larger projects spread over many directories and building on different platforms.