[CMake] Problem with target_link_libraries
Alexander Neundorf
a.neundorf-work at gmx.net
Sat May 9 16:47:32 EDT 2009
On Friday 08 May 2009, Tyler Roscoe wrote:
> On Fri, May 08, 2009 at 07:25:04PM +0200, Benoit wrote:
> > And i don't know why it link also with the static library
> > ..\3rdparty\lib\liblibjpeg.a ..\3rdparty\lib\libtinyxml.a because they
> > have already been linked in ..\x7s\src\x7scv\libx7scv.dll.a
> > ..\x7s\src\x7sxml\libx7sxml.dll.a
>
> By default, CMake handles transitive linking. That is, if A links to B
> and B links to C, then CMake knows that A must also link to C. This is
> true for shared libraries. I'm not sure how having static libraries in
> the mix affects this situation,
If you create static libraries in cmake, and link them against something using
target_link_libraries(), other targets linking against those static libs will
also be linked against their dependencies.
So yes, static libraries can appear multiple times when linking (and sometimes
must appear multiple times).
Alex
More information about the CMake
mailing list