I'm working on a project that's link against SOCI, which comes as both static and dynamic libraries. I'd like CMake to choose the static version when available, and dynamic otherwise. Is there a reasonable way to do this in CMake? I've come up with nothing looking through the docs so far.
However, don't forget it is GCC specific solution. Though, OP doesn't specify what compiler/linker/system is under consideration.
mloskot
2010-01-26 15:55:21
A:
...and don't forget that besides being a gcc specific solution, gcc will fail to link if you pass -static but not all libraries provided for linkage are static - which can easily happen if you use the FindXXXX.cmake modules.
pszilard
2010-09-22 11:03:58