[CMake] Dependency between Fortran projects added with cmake_add_fortran_subdirectory

victor.zverovich at gmail.com victor.zverovich at gmail.com
Sat Apr 12 13:51:04 EDT 2014


Hi,

I have a C++ project with two subprojects written in Fortran, sub1 and
sub2. To be able to build them on Windows with MinGW's gfortran, the
subprojects are added to the main project with
cmake_add_fortran_subdirectory as described in
http://www.kitware.com/blog/home/post/231. Moreover, sub2 calls functions
defined in sub1, so I link sub1 to sub2 using the following cmake command:

  target_link_libraries(sub2 sub1)

This woks fine on Linux but when I try to compile the project on Windows
with Visual C++ and gfortran I get the following error:

  ld.exe: cannot find -lsub1

Is there a way to link the library from another Fortran project so that it
worked on Windows with gfortran & VC++ too?

Thanks,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140412/6eb9a68f/attachment.html>


More information about the CMake mailing list