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

Dirk Mueller mueller at kde.org
Thu Jun 26 15:41:14 CEST 2008


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. 

> -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:

Index: MacroOptionalDependPackage.cmake
===================================================================
--- MacroOptionalDependPackage.cmake	(Revision 824638)
+++ MacroOptionalDependPackage.cmake	(Arbeitskopie)
@@ -13,10 +13,11 @@ MACRO (MACRO_OPTIONAL_DEPEND_PACKAGE _na
    set(_packagename Find${_name}.cmake)
    find_file(_PACKAGE_DEPEND_FOUND ${_packagename} PATHS ${CMAKE_MODULE_PATH} )
    if(NOT _PACKAGE_DEPEND_FOUND)
-	MESSAGE(STATUS "cmake package ${_packagename} was not found. This package 
needs ${_module_needed} to be compile all program")
-	set(DEPEND_PACKAGE_${_name} FALSE)
+      MESSAGE(STATUS "cmake package ${_packagename} not found, optional 
dependency ${_module_needed}")
+      set(DEPEND_PACKAGE_${_name} FALSE)
    else(NOT _PACKAGE_DEPEND_FOUND)
-   	set(DEPEND_PACKAGE_${_name} TRUE)	   
+      set(DEPEND_PACKAGE_${_name} TRUE)
    endif(NOT _PACKAGE_DEPEND_FOUND)
+   macro_log_feature(_PACKAGE_DEPEND_FOUND "${_packagename}" 
"${_module_needed}" "" FALSE "" "Optional dependency")
 ENDMACRO (MACRO_OPTIONAL_DEPEND_PACKAGE)
 
--- 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)
 
 macro (KDE4_INSTALL_HANDBOOK _lang)
    message(STATUS "KDE4_INSTALL_HANDBOOK() is deprecated. Remove it please. 

> I don't see a lot of sense in committing only the first part of it. If you
> think it makes sense, I can do that tomorrow.

I think both parts make sense to be committed. one part can't hurt, the other 
one is off-by-default. 

Greetings,
Dirk


More information about the Kde-buildsystem mailing list