CMake and dependencies

Andreas Pakulat apaku at
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
> target_link_libraries(
> 	akregatorstorageexporter
> 	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/ /kde4/trunk/kde/lib64/ 
> ../../lib/ /kde4/trunk/kde/lib64/ 
> /kde4/trunk/kde/lib64/ /kde4/qt/4.6/lib64/ 
> /kde4/qt/4.6/lib64/ -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.


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

More information about the Kde-buildsystem mailing list