[CMake] portable way of linking (external) libs statically/dynamically/for dlopen
Jean-Christophe Fillion-Robin
jchris.fillionr at kitware.com
Mon Apr 29 16:40:16 EDT 2013
For example:
https://github.com/commontk/CTK/blob/ac13c32312c9160190b80bd3a03d012782eff40c/Libs/Core/CMake/ctkMacroBFDCheck.cmake#L33-43
Hth
Jc
On Mon, Apr 29, 2013 at 4:36 PM, Alexander Neundorf <a.neundorf-work at gmx.net
> wrote:
> On Monday 29 April 2013, Philippe Cerfon 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?
>
> If cmake finds the static version of the library, it should properly use
> that
> one.
> Making cmake find the static version instead of the dynamic version is
> kind of
> hard, AFAIK the only way to do this is to give the full filename of the
> static
> lib.
>
> Alex
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130429/475bba87/attachment.htm>
More information about the CMake
mailing list