[CMake] mixing c/fortran - missing gfortran sometimes

Brad King brad.king at kitware.com
Thu Sep 23 12:56:52 EDT 2010


On 09/23/2010 12:20 PM, Clinton Stimpson wrote:
> 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.

Are the executables built in the same project as the 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?

This should be automatic.

What version of CMake are you using?

-Brad


More information about the CMake mailing list