[CMake] gfortran/CheckFortranFunctionExists.cmake issue with 2.6.0

Arjen Markus arjen.markus at wldelft.nl
Thu Jun 19 14:17:40 EDT 2008


>
> Regardless of the cause of this problem, with both g77 and gfortran I get
> the proper results (success if the function exists, failure if not) if I
> change
>
> external ${FUNCTION}
>
> ==>
>
> call ${FUNCTION}()
>
> within CheckFortranFunctionExists.cmake.
>
> Alin and Brad (and any other Fortran experts here who care to comment) do
> you think this change to using "call" rather than "external" will work for
> most/all other fortran compilers?
>
> If so, I will put in the appropriate bug fix request for 2.6.1.
>

The external statement simply declares the name to be that of an
external symbol, instead of (possibly) an intrinsic function/subroutine.

I guess that it does not always lead to a required symbol in the resulting
program - hence the fact that gfortran accepts this.

To make it foolproof, you can use:

      external ${FUNCTION}
      call ${FUNCTION}()

(the name that is substituted for "FUNCTION" just might be
the name of an intrinsic function/routine that that compiler
defines - with the external statement you avoid even that
- remote - possibility).

Regards,

Arjen



More information about the CMake mailing list