[CMake] Link in dependencies in static library

Philip Lowman philip at yhbt.com
Fri Oct 9 02:04:05 EDT 2009


On Thu, Oct 8, 2009 at 7:44 AM, Jeroen Dierckx <jeroen.dierckx at gmail.com>wrote:

> Hi,
> One of our static libraries is a thin C++ wrapper on top of expat. I want
> to hide dealing with expat from the users of this library, which is no
> problem as I can link in the static expat library with my lib. The user can
> just include and link with my XmlParser library.
>
> I linked the expat library with my static library in my cmake file
> (target_link_libraries), but this isn't reflected in my Visual Studio 2008
> project (Librarian/General/"Additional Dependencies" and "Additional Library
> Directories"). This has the result that the users of my XmlParser library
> have to link with expat themselves.
>
> Is this a deliberate feature of cmake? I know that when using cmake as a
> build system, expat is automatically linked when linking with my XmlParser
> library, but in my opinion there should at least be an option to actually
> link the dependencies in. Note that everything does work as expected when
> building a SHARED library in stead of a STATIC one.
>

You might be able to use this:
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:STATIC_LIBRARY_FLAGS

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091009/b21448e2/attachment.htm>


More information about the CMake mailing list