[CMake] link problem with cmake

Alexander Neundorf a.neundorf-work at gmx.net
Sun Oct 5 16:41:39 EDT 2008


On Sunday 05 October 2008, Oliver Dole wrote:
> Hello,
>
> I have a link problem with cmake on Linux.
> I work on owb, a webkit based browser, which uses cmake as build
> system. Here is how my cmake system works:
> - build balwtf.a, kjs.a and webcore.a
> - build libwebkit.so which requires balwtf.a, kjs.a and webcore.a
> - then I build owb.
>
> >From my point of view to do a correct link on linux, I simply should do:
>
> g++ -c main.cpp.o -lwebkit -o owb
> Unfortunately, by default cmake transitively links to targets with
> which the library itself was linked.
> so my link is currently the following:
> g++ -c main.cpp.o -lwebkit -Wl,--whole-archive -lbalwtf -lkjs
> -lwebcore.... -o owb

Does cmake support whole-archive now ? I didn't know that.

> It seems that there is something to do with LINK_INTERFACE_LIBRARIES
> to remove the default behaviour, but I do not know what. So any help
> on how to archieve that is welcome.

Please use at cmake >= 2.6.2.
Then specifiy the "link interface" of webkit, it's now done with a new 
argument to target_link_libraries().
target_link_libraries(webkit kjs balwtf webcore)
target_link_libraries(webkit LINK_INTERFACE_LIBRARIES )  <- makes the "link 
interface" empty.
I hope I remember correctly, since I didn't test this right now.

Alex






>
> Regards,


More information about the CMake mailing list