Warning, /frameworks/kdelibs4support/cmake/modules/KDE4Macros.cmake is written in an unsupported language. File is not indexed.

0001 # for documentation look at FindKDE4Internal.cmake
0002 
0003 # this file contains the following macros (or functions):
0004 # KDE4_ADD_UI_FILES
0005 # KDE4_ADD_UI3_FILES
0006 # KDE4_ADD_KCFG_FILES
0007 # _KDE4_SET_CUSTOM_TARGET_PROPERTY
0008 # _KDE4_GET_CUSTOM_TARGET_PROPERTY
0009 # KDE4_ADD_PLUGIN
0010 # KDE4_ADD_KDEINIT_EXECUTABLE
0011 # KDE4_ADD_UNIT_TEST
0012 # KDE4_ADD_EXECUTABLE
0013 # KDE4_ADD_WIDGET_FILES
0014 # KDE4_UPDATE_ICONCACHE
0015 # KDE4_INSTALL_ICONS
0016 # KDE4_REMOVE_OBSOLETE_CMAKE_FILES
0017 # KDE4_CREATE_HANDBOOK
0018 # KDE4_ADD_APP_ICON
0019 # KDE4_CREATE_MANPAGE
0020 # KDE4_CREATE_BASIC_CMAKE_VERSION_FILE (function)
0021 # KDE4_INSTALL_AUTH_HELPER_FILES
0022 # KDE4_AUTH_INSTALL_ACTIONS
0023 
0024 # Copyright (c) 2006-2009 Alexander Neundorf, <neundorf@kde.org>
0025 # Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
0026 # Copyright (c) 2007 Matthias Kretz <kretz@kde.org>
0027 #
0028 # Redistribution and use is allowed according to the terms of the BSD license.
0029 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0030 
0031 
0032 set(KDE4_MODULE_DIR  ${CMAKE_CURRENT_LIST_DIR} )
0033 
0034 # This macro doesn't set up the RPATH related options for executables anymore,
0035 # since now (wioth cmake 2.6) just the full RPATH is used always for everything.
0036 # It does create wrapper shell scripts for the executables.
0037 # It overrides the defaults set in FindKDE4Internal.cmake.
0038 # For every executable a wrapper script is created, which sets the appropriate
0039 # environment variable for the platform (LD_LIBRARY_PATH on most UNIX systems,
0040 # DYLD_LIBRARY_PATH on OS X and PATH in Windows) so  that it points to the built
0041 # but not yet installed versions of the libraries. So if RPATH is disabled, the executables
0042 # can be run via these scripts from the build tree and will find the correct libraries.
0043 # If RPATH is not disabled, these scripts are also used but only for consistency, because
0044 # they don't really influence anything then, because the compiled-in RPATH overrides
0045 # the LD_LIBRARY_PATH env. variable.
0046 macro (KDE4_HANDLE_RPATH_FOR_EXECUTABLE _target_NAME)
0047    if (UNIX)
0048       if (APPLE)
0049          set(_library_path_variable "DYLD_LIBRARY_PATH")
0050       elseif (CYGWIN)
0051          set(_library_path_variable "PATH")
0052       else (APPLE)
0053          set(_library_path_variable "LD_LIBRARY_PATH")
0054       endif (APPLE)
0055 
0056       if (APPLE)
0057          # DYLD_LIBRARY_PATH does not work like LD_LIBRARY_PATH
0058          # OSX already has the RPATH in libraries and executables, putting runtime directories in
0059          # DYLD_LIBRARY_PATH actually breaks things
0060          set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/:${KDE4_LIB_DIR}")
0061       else (APPLE)
0062          set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/:${LIB_INSTALL_DIR}:${KDE4_LIB_DIR}:${QT_LIBRARY_DIR}")
0063       endif (APPLE)
0064       get_target_property(_executable ${_target_NAME} LOCATION )
0065 
0066       # use add_custom_target() to have the sh-wrapper generated during build time instead of cmake time
0067       add_custom_command(TARGET ${_target_NAME} POST_BUILD
0068          COMMAND ${CMAKE_COMMAND}
0069          -D_filename=${_executable}.shell -D_library_path_variable=${_library_path_variable}
0070          -D_ld_library_path="${_ld_library_path}" -D_executable=$<TARGET_FILE:${_target_NAME}>
0071          -P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake
0072          )
0073 
0074       set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${_executable}.shell)
0075 
0076       # under UNIX, set the property WRAPPER_SCRIPT to the name of the generated shell script
0077       # so it can be queried and used later on easily
0078       set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT ${_executable}.shell)
0079 
0080    else (UNIX)
0081       # under windows, set the property WRAPPER_SCRIPT just to the name of the executable
0082       # maybe later this will change to a generated batch file (for setting the PATH so that the Qt libs are found)
0083       get_target_property(_executable ${_target_NAME} LOCATION )
0084       set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT ${_executable})
0085 
0086       set(_ld_library_path "${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}\;${LIB_INSTALL_DIR}\;${KDE4_LIB_DIR}\;${QT_LIBRARY_DIR}")
0087       get_target_property(_executable ${_target_NAME} LOCATION )
0088 
0089       # use add_custom_target() to have the batch-file-wrapper generated during build time instead of cmake time
0090       add_custom_command(TARGET ${_target_NAME} POST_BUILD
0091          COMMAND ${CMAKE_COMMAND}
0092          -D_filename="${_executable}.bat"
0093          -D_ld_library_path="${_ld_library_path}" -D_executable="${_executable}"
0094          -P ${KDE4_MODULE_DIR}/kde4_exec_via_sh.cmake
0095          )
0096 
0097    endif (UNIX)
0098 endmacro (KDE4_HANDLE_RPATH_FOR_EXECUTABLE)
0099 
0100 
0101 macro (KDE4_ADD_PLUGIN _target_NAME )
0102 #if the first argument is "WITH_PREFIX" then keep the standard "lib" prefix,
0103 #otherwise set the prefix empty
0104 
0105    set(_args ${ARGN})
0106    # default to module
0107    set(_add_lib_param "MODULE")
0108    set(_with_pre FALSE)
0109 
0110    foreach(arg ${_args})
0111       if (arg STREQUAL "WITH_PREFIX")
0112          set(_with_pre TRUE)
0113       endif (arg STREQUAL "WITH_PREFIX")
0114       if (arg STREQUAL "STATIC")
0115          set(_add_lib_param STATIC)
0116       endif (arg STREQUAL "STATIC")
0117       if (arg STREQUAL "SHARED")
0118          set(_add_lib_param SHARED)
0119       endif (arg STREQUAL "SHARED")
0120       if (arg STREQUAL "MODULE")
0121          set(_add_lib_param MODULE)
0122       endif (arg STREQUAL "MODULE")
0123    endforeach(arg)
0124 
0125    if(_with_pre)
0126       list(REMOVE_ITEM _args "WITH_PREFIX")
0127    endif(_with_pre)
0128    if(_add_lib_param STREQUAL "STATIC")
0129       list(REMOVE_ITEM _args "STATIC")
0130    endif(_add_lib_param STREQUAL "STATIC")
0131    if (_add_lib_param STREQUAL "SHARED")
0132       list(REMOVE_ITEM _args "SHARED")
0133    endif (_add_lib_param STREQUAL "SHARED")
0134    if (_add_lib_param STREQUAL "MODULE")
0135        list(REMOVE_ITEM _args "MODULE")
0136    endif (_add_lib_param STREQUAL "MODULE")
0137 
0138    set(_SRCS ${_args})
0139 
0140    if("${_add_lib_param}" STREQUAL "STATIC")
0141       add_definitions(-DQT_STATICPLUGIN)
0142    endif("${_add_lib_param}" STREQUAL "STATIC")
0143 
0144    add_library(${_target_NAME} ${_add_lib_param}  ${_SRCS})
0145 
0146    if (NOT _with_pre)
0147       set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
0148    endif (NOT _with_pre)
0149 
0150    # for shared libraries/plugins a -DMAKE_target_LIB is required
0151    string(TOUPPER ${_target_NAME} _symbol)
0152    string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _symbol ${_symbol})
0153    set(_symbol "MAKE_${_symbol}_LIB")
0154    set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol})
0155 
0156 endmacro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX)
0157 
0158 
0159 # this macro is intended to check whether a list of source
0160 # files has the "NOGUI" or "RUN_UNINSTALLED" keywords at the beginning
0161 # in _output_LIST the list of source files is returned with the "NOGUI"
0162 # and "RUN_UNINSTALLED" keywords removed
0163 # if "NOGUI" is in the list of files, the _nogui argument is set to
0164 # "NOGUI" (which evaluates to TRUE in cmake), otherwise it is set empty
0165 # (which evaluates to FALSE in cmake)
0166 # "RUN_UNINSTALLED" in the list of files is ignored, it is not necessary anymore
0167 # since KDE 4.2 (with cmake 2.6.2), since then all executables are always built
0168 # with RPATH pointing into the build dir.
0169 # if "TEST" is in the list of files, the _test argument is set to
0170 # "TEST" (which evaluates to TRUE in cmake), otherwise it is set empty
0171 # (which evaluates to FALSE in cmake)
0172 macro(KDE4_CHECK_EXECUTABLE_PARAMS _output_LIST _nogui _test)
0173 
0174    if(POLICY CMP0054)
0175       cmake_policy(PUSH)
0176       cmake_policy(SET CMP0054 NEW)
0177    endif()
0178 
0179    set(${_nogui})
0180    set(${_test})
0181    set(${_output_LIST} ${ARGN})
0182    list(LENGTH ${_output_LIST} count)
0183 
0184    list(GET ${_output_LIST} 0 first_PARAM)
0185 
0186    set(second_PARAM "NOTFOUND")
0187    if (${count} GREATER 1)
0188       list(GET ${_output_LIST} 1 second_PARAM)
0189    endif (${count} GREATER 1)
0190 
0191    set(remove "NOTFOUND")
0192 
0193    if ("${first_PARAM}" STREQUAL "NOGUI")
0194       set(${_nogui} "NOGUI")
0195       set(remove 0)
0196    endif ()
0197 
0198    if ("${first_PARAM}" STREQUAL "RUN_UNINSTALLED")
0199       set(remove 0)
0200    endif ()
0201 
0202    if ("${first_PARAM}" STREQUAL "TEST")
0203       set(${_test} "TEST")
0204       set(remove 0)
0205    endif ()
0206 
0207    if ("${second_PARAM}" STREQUAL "NOGUI")
0208       set(${_nogui} "NOGUI")
0209       set(remove 0;1)
0210    endif ()
0211 
0212    if ("${second_PARAM}" STREQUAL "RUN_UNINSTALLED")
0213       set(remove 0;1)
0214    endif ()
0215 
0216    if ("${second_PARAM}" STREQUAL "TEST")
0217       set(${_test} "TEST")
0218       set(remove 0;1)
0219    endif ()
0220 
0221 
0222    if (NOT "${remove}" STREQUAL "NOTFOUND")
0223       list(REMOVE_AT ${_output_LIST} ${remove})
0224    endif (NOT "${remove}" STREQUAL "NOTFOUND")
0225 
0226    if(POLICY CMP0054)
0227       cmake_policy(POP)
0228    endif()
0229 
0230 endmacro(KDE4_CHECK_EXECUTABLE_PARAMS)
0231 
0232 #deprecated now, use the macro in KInitMacros.cmake
0233 macro (KDE4_ADD_KDEINIT_EXECUTABLE _target_NAME )
0234 
0235    kde4_check_executable_params(_SRCS _nogui _test ${ARGN})
0236 
0237    configure_file(${KF5Init_DIR}/kde5init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp)
0238    set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp PROPERTIES SKIP_AUTOMOC TRUE)
0239    # under Windows, build a normal executable and additionally a dummy kdeinit5_foo.lib, whose only purpose on windows is to
0240    # keep the linking logic from the CMakeLists.txt on UNIX working (under UNIX all necessary libs are linked against the kdeinit
0241    # library instead against the executable, under windows we want to have everything in the executable, but for compatibility we have to
0242    # keep the library there-
0243    if(WIN32)
0244       if (MINGW)
0245          list(FIND _SRCS ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_res.o _res_position)
0246       else(MINGW)
0247          list(FIND _SRCS ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}.rc _res_position)
0248       endif(MINGW)
0249       if(NOT _res_position EQUAL -1)
0250          list(GET _SRCS ${_res_position} _resourcefile)
0251          list(REMOVE_AT _SRCS ${_res_position})
0252       endif(NOT _res_position EQUAL -1)
0253 
0254       set(_KDEINIT4_TARGET_NAME_ ${_target_NAME})
0255       string(REGEX REPLACE "[-]" "_" _KDEINIT4_TARGET_NAME_ "${_KDEINIT4_TARGET_NAME_}")
0256       configure_file(${KDE4_MODULE_DIR}/../KF5Init/kde5init_win32lib_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_win32lib_dummy.cpp)
0257       add_library(kdeinit_${_target_NAME} STATIC ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_win32lib_dummy.cpp)
0258 
0259       kde4_add_executable(${_target_NAME} "${_nogui}" ${_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ${_resourcefile})
0260 
0261       set_target_properties(kdeinit_${_target_NAME} PROPERTIES OUTPUT_NAME kdeinit5_${_target_NAME})
0262 
0263       target_link_libraries(${_target_NAME} kdeinit_${_target_NAME})
0264    else(WIN32)
0265 
0266       add_library(kdeinit_${_target_NAME} SHARED ${_SRCS})
0267 
0268       set_target_properties(kdeinit_${_target_NAME} PROPERTIES OUTPUT_NAME kdeinit5_${_target_NAME})
0269 
0270       if (Q_WS_MAC)
0271               list(FIND _SRCS *.icns _icon_position)
0272               if(NOT _res_position EQUAL -1)
0273                       list(GET _SRCS ${_icon_position} _resourcefile)
0274               endif(NOT _res_position EQUAL -1)
0275       endif (Q_WS_MAC)
0276       kde4_add_executable(${_target_NAME} "${_nogui}" ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ${_resourcefile})
0277       target_link_libraries(${_target_NAME} kdeinit_${_target_NAME})
0278    endif(WIN32)
0279 
0280 endmacro (KDE4_ADD_KDEINIT_EXECUTABLE)
0281 
0282 # Add a unit test, which is executed when running make test .
0283 # The targets are always created, but only built for the "all"
0284 # target if the option KDE4_BUILD_TESTS is enabled. Otherwise the rules for the target
0285 # are created but not built by default. You can build them by manually building the target.
0286 # The name of the target can be specified using TESTNAME <testname>, if it is not given
0287 # the macro will default to the <name>
0288 macro (KDE4_ADD_UNIT_TEST _test_NAME)
0289     set(_srcList ${ARGN})
0290     set(_targetName ${_test_NAME})
0291     if( ${ARGV1} STREQUAL "TESTNAME" )
0292         set(_targetName ${ARGV2})
0293         list(REMOVE_AT _srcList 0 1)
0294     endif( ${ARGV1} STREQUAL "TESTNAME" )
0295 
0296     set(_nogui)
0297     list(GET _srcList 0 first_PARAM)
0298     if( ${first_PARAM} STREQUAL "NOGUI" )
0299         set(_nogui "NOGUI")
0300     endif( ${first_PARAM} STREQUAL "NOGUI" )
0301 
0302     kde4_add_executable( ${_test_NAME} TEST ${_srcList} )
0303 
0304     if(NOT KDE4_TEST_OUTPUT)
0305         set(KDE4_TEST_OUTPUT plaintext)
0306     endif(NOT KDE4_TEST_OUTPUT)
0307     set(KDE4_TEST_OUTPUT ${KDE4_TEST_OUTPUT} CACHE STRING "The output to generate when running the QTest unit tests")
0308 
0309     set(using_qtest "")
0310     foreach(_filename ${_srcList})
0311         if(NOT using_qtest)
0312             if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_filename}")
0313                 file(READ ${_filename} file_CONTENT)
0314                 string(REGEX MATCH "QTEST_(KDE)?MAIN" using_qtest "${file_CONTENT}")
0315             endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_filename}")
0316         endif(NOT using_qtest)
0317     endforeach(_filename)
0318 
0319     get_target_property( loc ${_test_NAME} LOCATION )
0320     if(WIN32)
0321       if(MSVC_IDE)
0322         STRING(REGEX REPLACE "\\$\\(.*\\)" "\${CTEST_CONFIGURATION_TYPE}" loc "${loc}")
0323       endif()
0324       # .bat because of rpath handling
0325       set(_executable "${loc}.bat")
0326     else(WIN32)
0327       if (Q_WS_MAC AND NOT _nogui)
0328         set(_executable ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME}.app/Contents/MacOS/${_test_NAME})
0329       else (Q_WS_MAC AND NOT _nogui)
0330         # .shell because of rpath handling
0331         set(_executable "${loc}.shell")
0332       endif (Q_WS_MAC AND NOT _nogui)
0333     endif(WIN32)
0334 
0335     if (using_qtest AND KDE4_TEST_OUTPUT STREQUAL "xml")
0336         #MESSAGE(STATUS "${_targetName} : Using QTestLib, can produce XML report.")
0337         add_test( ${_targetName} ${_executable} -xml -o ${_targetName}.tml)
0338     else (using_qtest AND KDE4_TEST_OUTPUT STREQUAL "xml")
0339         #MESSAGE(STATUS "${_targetName} : NOT using QTestLib, can't produce XML report, please use QTestLib to write your unit tests.")
0340         add_test( ${_targetName} ${_executable} )
0341     endif (using_qtest AND KDE4_TEST_OUTPUT STREQUAL "xml")
0342 
0343 #    add_test( ${_targetName} ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME} -xml -o ${_test_NAME}.tml )
0344 
0345     if (NOT MSVC_IDE)   #not needed for the ide
0346         # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
0347         if (NOT KDE4_BUILD_TESTS)
0348            if(NOT TARGET buildtests)
0349               add_custom_target(buildtests)
0350            endif()
0351            add_dependencies(buildtests ${_test_NAME})
0352         endif (NOT KDE4_BUILD_TESTS)
0353     endif (NOT MSVC_IDE)
0354 
0355 endmacro (KDE4_ADD_UNIT_TEST)
0356 
0357 
0358 # add a  manifest file to executables.
0359 #
0360 # There is a henn-egg problem when a target runtime part is renamed using
0361 # the OUTPUT_NAME option of cmake's set_target_properties command.
0362 #
0363 # At now the Makefiles rules creating for manifest adding are performed
0364 # *after* the cmake's add_executable command but *before* an optional
0365 # set_target_properties command.
0366 # This means that in KDE4_ADD_MANIFEST the LOCATION property contains
0367 #  the unchanged runtime part name of the target. :-(
0368 #
0369 # The recently used workaround is to specify a variable build off the target name followed
0370 # by _OUTPUT_NAME before calling kde4_add_executable as shown in the following example:
0371 #
0372 # set(xyz_OUTPUT_NAME test)
0373 # kde4_add_executable( xyz <source>)
0374 # set_target_properties( xyz PROPERTIES OUTPUT_NAME ${xyz_OUTPUT_NAME} )
0375 #
0376 # The full solution would be to introduce a kde4_target_link_libraries macro and to
0377 # call KDE4_ADD_MANIFEST inside instead of calling in kde4_add_executable.
0378 # This would require patching of *all* places in the KDE sources where target_link_libraries
0379 # is used and to change the related docs.
0380 #
0381 # Because yet I found only 2 locations where this problem occurs (kjs, k3b), the workaround
0382 # seems to be a pragmatically solution.
0383 #
0384 # This macro is an internal macro only used by kde4_add_executable
0385 #
0386 macro (_KDE4_ADD_MANIFEST _target_NAME)
0387     set(x ${_target_NAME}_OUTPUT_NAME)
0388     if (${x})
0389         get_target_property(_var ${_target_NAME} LOCATION )
0390         string(REPLACE "${_target_NAME}" "${${x}}" _executable ${_var})
0391     else(${x})
0392         get_target_property(_executable ${_target_NAME} LOCATION )
0393     endif(${x})
0394 
0395     if (_kdeBootStrapping)
0396         set(_cmake_module_path ${CMAKE_SOURCE_DIR}/cmake/modules)
0397     else (_kdeBootStrapping)
0398         set(_cmake_module_path ${KDE4_INSTALL_DIR}/share/apps/cmake/modules)
0399     endif (_kdeBootStrapping)
0400 
0401     set(_manifest ${KDE4_MODULE_DIR}/Win32.Manifest.in)
0402     #message(STATUS ${_executable} ${_manifest})
0403     add_custom_command(
0404         TARGET ${_target_NAME}
0405         POST_BUILD
0406         COMMAND ${KDE4_MT_EXECUTABLE}
0407         ARGS
0408            -manifest ${_manifest}
0409            -updateresource:${_executable}
0410         COMMENT "adding vista trustInfo manifest to ${_target_NAME}"
0411    )
0412 endmacro(_KDE4_ADD_MANIFEST)
0413 
0414 
0415 macro (KDE4_ADD_EXECUTABLE _target_NAME)
0416 
0417    kde4_check_executable_params( _SRCS _nogui _test ${ARGN})
0418 
0419    set(_add_executable_param)
0420 
0421    # determine additional parameters for add_executable()
0422    # for GUI apps, create a bundle on OSX
0423    if (Q_WS_MAC)
0424       set(_add_executable_param MACOSX_BUNDLE)
0425    endif (Q_WS_MAC)
0426 
0427    # for GUI apps, this disables the additional console under Windows
0428    if (WIN32)
0429       set(_add_executable_param WIN32)
0430    endif (WIN32)
0431 
0432    if (_nogui)
0433       set(_add_executable_param)
0434    endif (_nogui)
0435 
0436    if (_test AND NOT KDE4_BUILD_TESTS)
0437       set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)
0438    endif (_test AND NOT KDE4_BUILD_TESTS)
0439 
0440    add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS})
0441 
0442    IF (KDE4_ENABLE_UAC_MANIFEST)
0443        _kde4_add_manifest(${_target_NAME})
0444    ENDIF(KDE4_ENABLE_UAC_MANIFEST)
0445 
0446    if (_test)
0447       set_target_properties(${_target_NAME} PROPERTIES COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/\\"")
0448    endif (_test)
0449 
0450    kde4_handle_rpath_for_executable(${_target_NAME})
0451 
0452 endmacro (KDE4_ADD_EXECUTABLE)
0453 
0454 include(GenerateExportHeader)
0455 
0456 macro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE)
0457 
0458    set(_first_SRC ${_lib_TYPE})
0459    set(_add_lib_param)
0460 
0461    if (${_lib_TYPE} STREQUAL "STATIC")
0462       set(_first_SRC)
0463       set(_add_lib_param STATIC)
0464    endif (${_lib_TYPE} STREQUAL "STATIC")
0465    if (${_lib_TYPE} STREQUAL "SHARED")
0466       set(_first_SRC)
0467       set(_add_lib_param SHARED)
0468    endif (${_lib_TYPE} STREQUAL "SHARED")
0469    if (${_lib_TYPE} STREQUAL "MODULE")
0470       set(_first_SRC)
0471       set(_add_lib_param MODULE)
0472    endif (${_lib_TYPE} STREQUAL "MODULE")
0473 
0474    set(_SRCS ${_first_SRC} ${ARGN})
0475 
0476    add_library(${_target_NAME} ${_add_lib_param} ${_SRCS})
0477 
0478    # for shared libraries a -DMAKE_target_LIB is required
0479    string(TOUPPER ${_target_NAME} _symbol)
0480    string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _symbol ${_symbol})
0481    set(_symbol "MAKE_${_symbol}_LIB")
0482    set_target_properties(${_target_NAME} PROPERTIES DEFINE_SYMBOL ${_symbol})
0483 endmacro (KDE4_ADD_LIBRARY _target_NAME _lib_TYPE)
0484 
0485 include("${KF5Auth_DIR}/KF5AuthMacros.cmake")
0486 include("${CMAKE_CURRENT_LIST_DIR}/KDECoreMacros.cmake")
0487 include("${CMAKE_CURRENT_LIST_DIR}/KDEUIMacros.cmake")
0488 include("${KF5DocTools_DIR}/KF5DocToolsMacros.cmake")
0489 include("${KF5DesignerPlugin_DIR}/KF5DesignerPluginMacros.cmake")
0490 
0491 # functions deprecated, they still should work
0492 macro (KDE4_AUTH_INSTALL_ACTIONS)
0493     message(WARNING "KDE4_AUTH_INSTALL_ACTIONS is deprecated, use KAUTH_INSTALL_ACTIONS instead")
0494     KAUTH_INSTALL_ACTIONS(${ARGN})
0495 endmacro()
0496 
0497 macro (KDE4_INSTALL_AUTH_HELPER_FILES)
0498     message(WARNING "KDE4_INSTALL_AUTH_HELPER_FILES is deprecated, use KAUTH_INSTALL_HELPER_FILES instead")
0499     KAUTH_INSTALL_HELPER_FILES(${ARGN})
0500 endmacro()
0501 
0502 macro (KDE4_CREATE_HANDBOOK)
0503     message(WARNING "KDE4_CREATE_HANDBOOK() is deprecated. Call the macro KDOCTOOLS_CREATE_HANDBOOK instead, this will give you a target <dirname>-handbook for creating the html help.")
0504     KDOCTOOLS_CREATE_HANDBOOK(${ARGN})
0505 endmacro()