[CMake] mixing c/fortran - missing gfortran sometimes

Clinton Stimpson clinton at elemtech.com
Thu Sep 23 12:20:43 EDT 2010


Hi,

I've got a source files for a mixed C/fortran going into one library.
If the library is shared, -lgfortran is added to the link line, and I'm good 
to go.
If it is static, -lgfortran is not added to any executable or shared library 
that links with this static library.

Should I add 
target_link_libraries(my_mixed_c_fortran_lib 
${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
to fix this?  Or should CMake do this for me?

Also, CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES is empty for Intel Fortran on 
Windows, and I have to specify the runtime libraries myself.

Clint


More information about the CMake mailing list