Anycorn
Anycorn

Reputation: 51435

CMake c++ library linking

I have Fortran target in CMake which relies on C++ libraries. What is portable way to include STDC++ into linking?

Upvotes: 1

Views: 1555

Answers (2)

rubenvb
rubenvb

Reputation: 76509

If you're linking with gfortran, add -lstdc++, if linking with g++, you'll need -lgfortran. Either way, you'll need both of them, it's just that g++ automagically links with libstdc++, and gfortran automagically links with libgfortran.

There is no "portable" way as in cross-compiler or cross-"standard library vendor", because all the libraries are named differently.

Upvotes: 1

Naszta
Naszta

Reputation: 7734

Theoretically the STL is part of the C++, so you don't need to do anything in CMake to use STL. On other hand: if your C++ libraries have dependencies and their have CMake module (e.g.: FintQt4), CMake automatically handle the linking process.

Upvotes: 0

Related Questions