[CMake] linking static vs dynamic

Andreas Pakulat apaku at gmx.de
Sat Feb 12 15:39:39 EST 2011


On 12.02.11 21:20:58, Dominik Szczerba wrote:
> I never actually saw a solution to this problem in cmake:
> I need to link (independent constraint from above) with libguide.a and
> not libguide.so (in intel compiler, does not matter much), but both
> are available, and cmake always takes the shared one when given
> "guide" as the desired library to be linked.
> Is there an elegant way of static linking (other than -static passed
> to the linker for static linking of everything) of this particular lib
> other than hacking (like deleting the .so from the folder)?

No, i.e. no elegant way. What you can do is force cmake to search only
for .a files by setting a cmake variable, unfortunately I don't remember
which one and can't easily find it right now. The archive of this list
has more info as well as the cmake manual or the FAQ on the cmake
website.

Andreas

-- 
You will gain money by an illegal action.


More information about the CMake mailing list