Skip to content

DOCS: CheckFortranSource{Runs,Compiles}.cmake

scivision requested to merge scivision/cmake:fortran-docs into master

Add a little explanation and example of why one would use these commands, which are particularly useful as the complex Fortran compiler version vs. feature landscape is far too complex to make Fortran compiler feature tables for CMake as for C/CXX.

Side note: the minimum Fortran program is end. Example CmakeLists.txt:

cmake_minimum_required(VERSION 3.13.20190116)
project(minimumFortran Fortran)

include(CheckFortranSourceCompiles)
check_fortran_source_compiles("end" OKC SRC_EXT F90)

include(CheckFortranSourceRuns)
check_fortran_source_runs("end" OKR)
cmake ..

...
-- Performing Test OKC
-- Performing Test OKC - Success
-- Performing Test OKR
-- Performing Test OKR - Success
...
Edited by scivision

Merge request reports