Reducing excess linkage - cmake 2.6 IMPORTED targets and LINK_INTERFACE_LIBRARIES for kdelibs

Modestas Vainius modestas at vainius.eu
Sun Jun 29 09:47:44 CEST 2008


Hello,

Ok, my comments about your reduced_linking_2.patch can be found below:

> khtml
> LINK_INTERFACE_LIBRARIES "kparts;kjs;kio;kdeui;kdecore"
Please drop kjs. It is definitely excess here because none of our 
target_link_libraries fixes has ever included it.

> krosscore
> LINK_INTERFACE_LIBRARIES "kdecore;${QT_QTSCRIPT_LIBRARY};
{QT_QTXML_LIBRARY}")
krosscore public headers do not include any KDE specific headers. Replace 
kdecore with QtCore. The only QtXml user is kross/core/action.h 
fromDomElement/toDomElement. I don't think this is enough to link all 
krosscore users against QtXml.

> krossui 
> LINK_INTERFACE_LIBRARIES "krosscore
In addition, you probably want to add QtGui here.

> kio
> LINK_INTERFACE_LIBRARIES "kdeui;kdecore;${QT_QTNETWORK_LIBRARY};
${QT_QTXML_LIBRARY}"
Could you please justify QtNetwork and QtXml here? None of public kio headers 
need QtNetwork (actually, QtNetwork is not worth bundling with anything). 
QtXml users are kbookmark*.h (internal method) and davjob.h. In my opinion, 
they are not good enough reason to pull QtXml. Application can specify it 
manually. However, it is true that there will be relatively many linking 
failures due to missing QtXml. 96% of them is due to application code using 
QtXml directly in the code and not specifying it as linkage library.

> kdeui
> LINK_INTERFACE_LIBRARIES "kdecore;${QT_QTSVG_LIBRARY};${QT_QTGUI_LIBRARY}"
It is true that kdeui exposes QtSvg, but kdeui is used extensively in KDE 
(directly and via kio and its dependencies). QtSvg is needed used by ~13 
targets in official KDE modules whereas kdeui is probably needed by ~90% of 
all KDE applications. Hence, I don't think it is worth to have in kdeui 
interface libraries.

> kdecore
>  LINK_INTERFACE_LIBRARIES "${QT_QTDBUS_LIBRARY};${QT_QTCORE_LIBRARY}")
It is true that kdecore/util/klauncher_iface.h exposes QtDBus interface. But 
the need for it rarely comes from klauncher_iface users. It is true, that 
QtDBus is needed by ~40% KDE applications (libraries, kioslaves and other 
stuff usually don't need it) so you would get a lot of linking failures due to 
QtDBus. However, application developers could be taught to specify 
QT_QTDBUS_LIBRARY directly since it is their code (or explicitly autogenerated 
stuff) in *.cpp using this library in 96% of the cases.

In addition, it is a good idea to set LINK_INTERFACE_LIBRARIES for:

kdnssd -> ${QT_QTCORE_LIBRARY}
ktexteditor -> kdeui;kparts
kdesu -> ${QT_QTCORE_LIBRARY}
knewstuff2 -> ${QT_QTCORE_LIBRARY}
knotifyconfig  -> ${QT_QTCORE_LIBRARY};${QT_QTGUI_LIBRARY}
kpty -> kdecore
kutils -> kdeui
solid -> ${QT_QTCORE_LIBRARY}
${KJSEMBEDLIBNAME} -> "${KJSLIBNAME};${QT_QTCORE_LIBRARY}

I can prepare a patch with all these changes if you agree with them.

-- 
Modestas Vainius <modestas at vainius.eu>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20080629/113e6edc/attachment.pgp 


More information about the Kde-buildsystem mailing list