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

Alexander Neundorf neundorf at kde.org
Fri Jun 27 00:58:21 CEST 2008


On Thursday 26 June 2008, Dirk Mueller wrote:
> On Thursday 26 June 2008, Alexander Neundorf wrote:
> > Currently this patch does two things
> > -it adds more libs to the TARGET_LINK_LIBRARIES() calls - wouldn't hurt
> > to commit that part
>
> exactly, and it is the right thing to do.

Done.

Attached is the remaining part of the patch.

> > -it sets the LINK_INTERFACE_LIBRARIES target property - this can hurt
> > with cmake 2.6 even if that option is not enabled
>
> Hmm, okay. I think we can fix that via another level of indirection:
>
> --- KDE4Macros.cmake
> +++ KDE4Macros.cmake
> @@ -1186,6 +1186,11 @@ macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES
>     endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX)#  AND NOT APPLE)
>  endmacro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES)
>
> +macro (KDE4_TARGET_LINK_INTERFACE_LIBRARIES _target _interface_libs)
> +   if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX )# AND NOT APPLE)
> +      set_target_properties("${_target}" "${_interface_libs}")
> +   endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX)#  AND NOT APPLE)
> +endmacro (KDE4_TARGET_LINK_INTERFACE_LIBRARIES)

Hmm, I don't like that.
If we do it, I'd prefer that we do it only this new way, i.e. all KDE builds 
will use the new style.
Adding the macro to KDE4Macros.cmake means that we have to maintain it for all 
of KDE 4.x.
I'd prefer to see it as a temporary hack during the transition.

How about prefixing it with an underscore to make clear it's no public macro ?

And additionally moving it out of KDE4Macros.cmake into 
kdelibs/CMakeLists.txt, so it stays within kdelibs. We might need to copy it 
ti kdepimlibs. Is this actually important also for libraries in other 
modules ? I guess with the libs from kdelibs not dragging in that many 
libraries the effect of libs in other modules shouldn't be big.

Or, instead of using a macro, how about this:

if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX )
   set(DISABLE )
else(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX )
   set(DISABLE DISABLED_PROPERTY_)
endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT  AND  UNIX )

and then do 

set_target_properties(khtml PROPERTIES VERSION ${KDE_NON_GENERIC_LIB_VERSION} 
           SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION}
           ${DISABLE}LINK_INTERFACE_LIBRARIES "kparts;kjs;kio;kdeui;kdecore")

So if the option is enabled, DISABLE is empty and the correct property is set, 
otherwise a useless property is set.
Still this should be done only for the transition period I'd say.

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reduced_linking_2.patch
Type: text/x-diff
Size: 6249 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20080627/3f34229f/attachment.bin 


More information about the Kde-buildsystem mailing list