[CMake] Fortran program linked with C++ library

Marcin Wojdyr wojdyr at gmail.com
Sat Aug 31 10:50:14 EDT 2013


Hello,
What's the best practice for linking Fortran program with C++ library?
The library is external, built using autotools, either dynamic or static.

The problem is that runtime c++ library is not linked when the library
is static.
I though that the recommended way to deal with it is:

set_property(TARGET ${prog} PROPERTY LINKER_LANGUAGE CXX)

It works fine with GCC but I've just found out it doesn't work with
Intel compiler on Linux:
undefined reference to `main'
I'm not sure how about other compilers.

Is there a better way?

Marcin


More information about the CMake mailing list