[CMake] Testing with multiple Fortran compilers

William Clodius w.clodius at icloud.com
Thu Apr 12 22:33:46 EDT 2018


I have been using CMake with gfortran for a number of years, and now want test my code with ifort. I want to switch easily switch between compilers. My CMakeLists.txt file is based on the fortran example from make.org an appears to have most of the infrastructure needed, but I don’t understand how the line

get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)

determines the Fortran compiler to be used. Does it examine the FC system variable? Does it require the full pathname to the compiler executable? Do I have to delete the CMakeCache.txt, Makefile, and cmake_install.cmake each time I change compilers?


More information about the CMake mailing list