[CMake] detecting fortran c interface

Jack Stalnaker omnijack at gmail.com
Wed Nov 4 10:23:57 EST 2015


Hi,

I see that there is a built-in FortranCInterface module that provides a lot
of useful information for calling Fortran from C and C++. However, is there
a module that does the opposite? Specifically, I need to check that the
Fortran compiler supports calling C routines. In our autoconf script we do
this by test linking a program like so:

AC_LINK_IFELSE(AC_LANG_PROGRAM([],[use iso_c_binding])],
                            [action-if-yes],[action-if-no])

which just attempts to compile and link a one line program "use
iso_c_binding".

I know I can simply recreate this in cmake, but if there is a module that
does it already, or if FortranCInterface does it already, I'd like to avoid
reinventing the wheel.

Is there something that does this?
--Jack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151104/16d9ab25/attachment-0001.html>


More information about the CMake mailing list