[CMake] link problem with cmake
Oliver Dole
odole at sand-labs.org
Mon Oct 6 03:32:46 EDT 2008
On 10/5/08, Alexander Neundorf <a.neundorf-work at gmx.net> wrote:
> 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.
>
kind of...
I have done the followig "ugly" thing to make cmake support it:
if(CMAKE_COMPILER_IS_GNUCXX)
set(WEBKKIT_LD_FLAGS "-Wl,-whole-archive -lbalwtf -lkjs -lwebcore
-Wl,-no-whole-archive")
endif(CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(webkit-owb
${WEBKKIT_LD_FLAGS}
${EXTERNAL_DEPS_LIBRARIES}
)
>
> > 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.
>
Thanks, after an update to cmake 2.6.2 it perfectly works.
> Alex
>
>
>
>
>
>
> >
> > Regards,
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
--
Olivier DOLE
Pleyo
Software Engineer
More information about the CMake
mailing list