ecbuild_check_fortran_source_return

Compile and run a given Fortran code and return its output.

ecbuild_check_fortran_source_return( <source>
                                     VAR <name>
                                     OUTPUT <name>
                                     [ INCLUDES <path1> [ <path2> ... ] ]
                                     [ LIBS <library1> [ <library2> ... ] ]
                                     [ DEFINITIONS <def1> [ <def2> ... ] ] )

Options

VAR : required
name of the check and name of the CMake variable to write result to
OUTPUT : required
name of CMake variable to write the output to
INCLUDES : optional
list of paths to add to include directories
LIBS : optional
list of libraries to link against (CMake targets or external libraries)
DEFINITIONS : optional
list of definitions to add to preprocessor defines

Usage

This will write the given source to a .f file and compile and run it with ecbuild_try_run. If successful, ${VAR} is set to 1 and ${OUTPUT} is set to the output of the successful run in the CMake cache.

The check will not run if ${VAR} is defined (e.g. from ecBuild cache).