This is Ubuntu 20.04 LTS / x86_64 / gcc, g++, gfortran 9.3.0 / cmake 3.16.3 here.
The building of the current “v6-24-00-patches” branch fails to compile “g2root” and “h2root” (for all three C++11, C++14 and C++17 builds).
I am configuring it with “-Dall=ON” and then …
“root-config --has-fortran” says “yes”
“root-config --f77” says “CMAKE_Fortran_COMPILER-NOTFOUND”
It seems that the configuration step does not even try to “Check for working Fortran compiler” at all.
Any ideas?
Looking at the corresponding “v6.24/06” binary distribution provided by the ROOT team, I can see that both Fortran-related executables are there. How come?
BTW. I am able to build both executables with the current “v5-34-00-patches” branch, which is also internally using “CMAKE_Fortran_COMPILER”.
If, instead of “-Dall=ON”, I explicitly use “-Dfortran=ON”, it checks for working Fortran compiler, and it compiles both executables.
Note: @Axel I spotted this bug for the “fortran” feature but, maybe also other components, which are enabled by “-Dall=ON”, face the same problems (i.e., they are “enabled”, but the required configuration steps are omitted).
You are right, the problem is that in CMakeLists.txt the line include(CheckCompiler) comes right before include(RootBuildOptions), and if you use -Dall=ON, the options are enabled in that second module, which is too late for CheckCompiler to enable the Fortran compiler. I think that just swapping those two lines should fix the problem, but I’m not sure if RootBuildOptions needs to use information from CheckCompiler, so that needs to be double checked.