[CMake] Link Fortran executable with C library using CommandLineTools C compiler on Mac OSX

Algiane Froehly algiane.froehly at inria.fr
Tue Apr 11 05:31:55 EDT 2017


Hi,

I am trying to link a fotran program with a C library on Mac.

Using the gcc compiler it works perfectly but if I use the commandLineTools compiler, I end up with an error at linking. It happens with both gfortran and pgf90 (not ifort).
I can build manually my executable if I remove the -lto_library library that is added by the CMAKE_C_IMPLICIT_LINK_LIBRARIES variable.

What can I do to make it work automatically (I have found a post saying that it is not possible to overwrite the CMAKE_C_IMPLICIT_LINK_LIBRARIES variable)?

Is it normal that gfortran and pgf90 adds the link to the to_library and not ifort?

Thank you for your help,

Regards,

Algiane Froehly.





More information about the CMake mailing list