[CMake] portable way of linking (external) libs statically/dynamically/for dlopen

Ian Monroe ian at monroe.nu
Mon Apr 29 14:30:29 EDT 2013


On Mon, Apr 29, 2013 at 11:13 AM, Philippe Cerfon <philcerf at gmail.com>wrote:

> Hi.
>
> I've always thought one of the main objectives of cmake was being
> portable, right?
> So I was looking for a way to let the user (i.e. the person building a
> project) choose how he wan't to link each external library (i.e. not
> the ones built as targets by my project), depending on what that lib
> supports and (when my own code supports it:) dynamically loaded via
> e.g. dlopen.
>
> But it seems that I cannot even tell CMake (in a portable way) that it
> should use static or dynamic linking for some external lib (not to
> talk about the core libs like libc or libstdc++).
> Of course I can work around this any manually search for e.g. .so and
> .a files... but that woudln't be portable anymore... not to talk about
> different linkage options per linker... so ideally CMake should (IMHO)
> take care of all this (for each supported platform/linker).
>
>
> Am I missing something? Or is that just som major deficiency in the
> portable-part?
>

Static linking of external libraries is just a weird thing to do.

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130429/9131f297/attachment.htm>


More information about the CMake mailing list