开发者

CMake c++ library linking

开发者 https://www.devze.com 2023-03-04 05:12 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消