diff options
author | Alexander Neundorf <neundorf@kde.org> | 2008-06-03 20:01:54 +0000 |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2008-06-03 20:01:54 +0000 |
commit | a153ac8ccb726f24b52c74b3f644d67c15b1b3f2 (patch) | |
tree | bff37e92d47345465a34f82b00445de503d3d7d5 /modules | |
parent | 4f15f0d815776fcb9af5ac2c09a3500c80466db7 (diff) | |
download | extra-cmake-modules-a153ac8ccb726f24b52c74b3f644d67c15b1b3f2.tar.gz extra-cmake-modules-a153ac8ccb726f24b52c74b3f644d67c15b1b3f2.tar.bz2 |
As discussed with Dirk, make the link interface empty by default, i.e. by default apps linking to libfoo won't be linked to the
libs libfoo.so links against too anymore.
This can be enabled by setting with the option KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT.
If enabled, this currently breaks already kdelibs and probably other modules too.
Dirk will test.
Alex
CCMAIL: mueller@kde.org
CCMAIL: modestas@vainius.eu
svn path=/trunk/KDE/kdelibs/; revision=816409
Diffstat (limited to 'modules')
-rw-r--r-- | modules/KDE4Macros.cmake | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 8f96c194..eb0de61a 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -929,6 +929,16 @@ macro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) set(_symbol "MAKE_${_symbol}_LIB") set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol}) + # if that option is enabled, by default don't add any linked libraries to the "exported" + # link interfaces, so that executables linking against this library won't get additional + # indirect dependencies. This makes work easier for packagers and should make application + # startup somewhat faster, if I understood Dirk correctly. + if(NOT "${_add_lib_param}" STREQUAL "STATIC") + if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT AND UNIX )# AND NOT APPLE) + set_target_properties(${_target_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "" ) + endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT AND UNIX)# AND NOT APPLE) + endif(NOT "${_add_lib_param}" STREQUAL "STATIC") + endmacro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE) @@ -1128,7 +1138,8 @@ macro (KDE4_ADD_APP_ICON appsources pattern) list(APPEND ${appsources} ${_outfilename}.icns) # this doesn't seem to work for me - Use manual "install" instead - # SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${target}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + # TODO: test again with cmake 2.6 ? + # SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${target}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) install(FILES ${_outfilename}.icns DESTINATION ${BIN_INSTALL_DIR}/${target}.app/Contents/Resources/) @@ -1144,6 +1155,38 @@ macro (KDE4_ADD_APP_ICON appsources pattern) endmacro (KDE4_ADD_APP_ICON) +macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename) + if(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT AND UNIX )# AND NOT APPLE) + + # get all cmake variables which end in _LIB_DEPENDS + # then parse the target name out of them + # use the target name to get the LINK_INTERFACE_LIBRARIES target property + # This way for targets where INTERFACE_LINK_LIBRARIES has been set, the value set from + # export_library_dependencies() will be overridden, while for those where it hasn't been set + # the full list is preserved. + # (this is cmake 2.6 compatible, where we'll use the EXPORT() feature + # Alex + + file(${_append_or_write} "${_filename}" "# The following variables have been created by kde4_export_library_dependencies() +# The contents have been determined from the LINK_INTERFACE_LIBRARIES target property of the respective libraries. +# The option KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT has been enabled to create the file this way. +# You can modify KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT using \"make edit_cache\"\n\n") + get_cmake_property(allVars VARIABLES) + set(allLibs "") + foreach(currentVar ${allVars}) + string(REGEX REPLACE "^(.+)_LIB_DEPENDS$" "\\1" target "${currentVar}") + if(NOT "${target}" STREQUAL "${currentVar}") + get_target_property(interfaceLibs ${target} LINK_INTERFACE_LIBRARIES) + if(NOT "${interfaceLibs}" MATCHES "NOTFOUND") + file(APPEND "${_filename}" "SET(\"${currentVar}\" \"${interfaceLibs}\")\n") + endif(NOT "${interfaceLibs}" MATCHES "NOTFOUND") + endif(NOT "${target}" STREQUAL "${currentVar}") + endforeach(currentVar ${allVars}) + + endif(KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT AND UNIX)# AND NOT APPLE) +endmacro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES) + + macro (KDE4_INSTALL_HANDBOOK _lang) message(STATUS "KDE4_INSTALL_HANDBOOK() is deprecated. Remove it please. Now all is done in KDE4_CREATE_HANDBOOK.") endmacro (KDE4_INSTALL_HANDBOOK ) |