I have Fortran target in CMake which relies on C++ libraries. What is portable way to include STDC+开发者_StackOverflow社区+ into linking?
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.
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.
精彩评论