Linking error ? Reduced link interface now active

Alexander Neundorf neundorf at kde.org
Tue Jul 29 00:43:14 CEST 2008


Hi all,

since today the reduced link interface (mainly) for kdelibs is active (as 
discussed on kde-buildsystem since April or so)

What does that mean ?

Until now, if you linked a library A against other libraries B, C and D using 
TARGET_LINK_LIBRARIES(), and you then linked application foo against library 
A, the libraries B, C and D were added automatically to the link command by 
cmake.
In general this is necessary for static libs, but in KDE we don't really 
support static libs and (mostly) packagers didn't like that behaviour, since 
it creates more dependencies for packets.
So this is now disabled.

This means if you link application foo now against library A, then B, C and D 
won't be added automatically anymore. This means if foo uses symbols from 
library C, you now get undefined references when linking, since C is not 
linked automatically anymore. To fix that you have to add library C to the 
TARGET_LINK_LIBRARIES() call for foo.

If there is a library bar which always requires that you link to an additional 
library blub, this can still be done, by setting the target 
property "LINK_INTERFACE_LIBRARIES":

set_target_properties(bar PROPERTIES LINK_INTERFACE_LIBRARIES blub)

You can see this e.g. in kdelibs/kdecore/CMakeLists.txt for the kdecore 
library. 

We (i.e. Dirk) tried to fix all linking problems caused by this change in the 
last days, but probably in some configurations there will still be some 
linker problems. Hopefully you now have an idea what caused them and how to 
fix it :-)
Otherwise, let us know on k-c-d or better kde-buildsystem

Alex


More information about the Kde-buildsystem mailing list