CMake and dependencies

Andreas Pakulat apaku at gmx.de
Fri Jul 30 02:31:19 CEST 2010


On 29.07.10 23:17:54, Michael Jansen wrote:
> I think i have a wrong idea about cmake
> 
> From akregator (kdepim 4.5)
> 
> target_link_libraries(
> 	akregatorinterfaces
> 	kdepim
> 	${KDE4_KHTML_LIBS}
>         ${KDEPIMLIBS_SYNDICATION_LIBS}
>         ${KDE4_KDE3SUPPORT_LIBRARY})
> 
> target_link_libraries(
> 	akregatorstorageexporter
> 	${KDE4_KDECORE_LIBS}
> 	${KDEPIMLIBS_SYNDICATION_LIBS}
> 	akregatorinterfaces)
> 
> shouldn't akregatorstorageexporter link agains khtml too? From the link.txt
> 
> /kde4/trunk/kde/bin/c++ --no-add-needed -Q -v -Wl,-t   -Wnon-virtual-dtor -Wno-long-long -ansi -
> Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -
> DQT_NO_EXCEPTIONS -fno-check-new -fno-common -Woverloaded-virtual -fno-threadsafe-statics -
> fvisibility=hidden -fvisibility-inlines-hidden -g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-
> inline  -Wl,--enable-new-dtags  
> CMakeFiles/akregatorstorageexporter.dir/akregatorstorageexporter_automoc.o 
> CMakeFiles/akregatorstorageexporter.dir/akregatorstorageexporter.o  -o akregatorstorageexporter -
> rdynamic -L/home/mjansen/kde4/trunk/bld/KDE/kdepim/lib -L/kde4/trunk/kde/lib64 -L/kde4/qt/4.6/lib64 
> /kde4/trunk/kde/lib64/libkdecore.so.5.5.0 /kde4/trunk/kde/lib64/libsyndication.so.4.5.0 
> ../../lib/libakregatorinterfaces.so.4.5.0 /kde4/trunk/kde/lib64/libsyndication.so.4.5.0 
> /kde4/trunk/kde/lib64/libkdecore.so.5.5.0 /kde4/qt/4.6/lib64/libQtDBus.so 
> /kde4/qt/4.6/lib64/libQtCore.so -lpthread -Wl,-
> rpath,/home/mjansen/kde4/trunk/bld/KDE/kdepim/lib:/kde4/trunk/kde/lib64:/kde4/qt/4.6/lib64 -Wl,-
> rpath-link,/home/mjansen/kde4/trunk/bld/KDE/kdepim/lib:/kde4/trunk/kde/lib64 
> 
> look ma. No libkhtml.
>
> What's wrong here? My expectations. The akregatorinterfaces CMakeLists.txt?

No it shouldn't unless akregatorinterfaces explicitly lists khtml in its
LINK_INTERFACE_LIBRARIES (see man cmake, target_link_libraries). And
that should only happen if akregratorinterfaces uses symbols from khtml
in its public API. If its all inside the .cpp file then there's no
reason to declare khtml as interface-library.

If akregatorstorageexporter uses symbols from khtml it needs to
explicitly link against the library (unless another of the libs it links
against has it in the interface-libs). 

Also this interface-libs stuff only works with cmake targets (real ones
or imported ones properly set up), so if thats not the case you also
have to link khtml explicitly.

Andreas

-- 
If you can read this, you're too close.


More information about the Kde-buildsystem mailing list