[CMake] C++ linkage, Fortran standard lib

Nico Schlömer nico.schloemer at gmail.com
Thu Jan 13 16:54:15 EST 2011


Hi,

about half a year ago, there's been a discussion here about C++
linking with dependencies to libgfortran present which did not
automatically get resolved. The issue evolved around the Trilinos
toolkit.

The situation was that first, the Trilinos libraries are build,
supposed to be linked with BLAS and LAPACK eventually. When the client
application builds and links against Trilinos, its libs as well as
BLAS and LAPACK are included without problems. However, both BLAS and
LAPACK contain references to the standard Fortran library depending on
the platform, a fact that the (C++) client application cannot be aware
of.

Back then, the following workaround was suggested:
The user "knows" what the necessary Fortran libraries are, and
manually adds them to the link line of the client application. This
could happen via the CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES variable
for example.

Now, I have a similar code (Trilinos as well, it just so happens) and
the same problem. As I'm using the same build system to build the code
on several machines, however, I cannot just hardcode the link
libraries.

Has there been development in this direction in the past months, or
are there possibly any other suggestions how to deal with this?

Cheers,
Nico


More information about the CMake mailing list