[CMake] creating static library with references to other .lib files

David Cole david.cole at kitware.com
Thu Jun 14 07:03:26 EDT 2007


It's "advanced" CMake use, but you might want to have a look at overriding
the CMake "rule variable" CMAKE_CXX_CREATE_STATIC_LIBRARY. (Or _C_ if it's C
source code.) You should be able to add some linker flags in there, although
they may apply to all static libraries built in the whole project. I'm not
100% clear myself on how these rule variables work...

Perhaps somebody else who has used a technique like this can chime in?


HTH,
David

On 6/14/07, Jesper Eskilson <jesper at eskilson.se> wrote:
>
>
>
> 2007/6/14, Brandon Van Every <bvanevery at gmail.com>:
> >
> > On 6/13/07, Jesper Eskilson <jesper at eskilson.se> wrote:
> > > 2007/6/13, Brandon Van Every <bvanevery at gmail.com>:
> > > >
> > > > But why don't you just ship your users a dynamic lib?  As far as I
> > > > know, there are no restrictions on dynamic libs including static
> > libs.
> > >
> > > That is an alternative, but it requires a non-trivial amount of work,
> > > testing, documentation fixes etc., which I'd prefer not to embark on
> > > at the moment.
> >
> > I take it you have no infrastructure for dynamic libs at all in your
> > code then?  Because if you did, like all your declspecs and so forth,
> > it's pretty easy to add in CMake.
>
>
> The problem isn't CMake in that case, it's updating all the stuff around
> it which assumes that the lib is static: documentation (the lib is part of a
> SDK shipped to customers), testing, etc. That's not something I want to do
> at this time.
>
> Is it really impossible to pass an option to the linker when creating a
> static library?
>
> --
> /Jesper
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070614/bda17e37/attachment.htm


More information about the CMake mailing list