diff options
author | Laurent Montel <montel@kde.org> | 2007-09-24 06:23:52 +0000 |
---|---|---|
committer | Laurent Montel <montel@kde.org> | 2007-09-24 06:23:52 +0000 |
commit | af86510dc0c1aabc1ab42ac98250812635e32323 (patch) | |
tree | 4a3477320bcb25d39e866aad4ae28d5a5e2129ce /modules/KDE4Macros.cmake | |
parent | fe55c51b9139309ce32ca18389c45279272a5d4a (diff) | |
download | extra-cmake-modules-af86510dc0c1aabc1ab42ac98250812635e32323.tar.gz extra-cmake-modules-af86510dc0c1aabc1ab42ac98250812635e32323.tar.bz2 |
Adapt CMakeLists.txt as discussed with Alex.
KDE4_ADD_TEST_EXECUTABLE is deprecated now use KDE4_ADD_EXECUTABLE(<target> TEST <files>) instead
QT4_ADD_DBUS_INTERFACE_NO_NAMESPACE and QT4_ADD_DBUS_INTERFACES_NO_NAMESPACE are deprecated too
used SET_SOURCE_FILES_PROPERTIES(<files> PROPERTIES NO_NAMESPACE TRUE) QT4_ADD_DBUS_INTERFACES(<srcList> <files>)
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) is put in each CMakeLists.txt where
KDE4_ADD_EXECUTABLE(<target> TEST <files>) and KDE4_ADD_UNIT_TEST were used.
svn path=/trunk/KDE/kdelibs/; revision=716146
Diffstat (limited to 'modules/KDE4Macros.cmake')
-rw-r--r-- | modules/KDE4Macros.cmake | 62 |
1 files changed, 25 insertions, 37 deletions
diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake index 87479b8b..6e69fb33 100644 --- a/modules/KDE4Macros.cmake +++ b/modules/KDE4Macros.cmake @@ -12,7 +12,6 @@ # KDE4_ADD_PLUGIN # KDE4_ADD_KDEINIT_EXECUTABLE # KDE4_ADD_UNIT_TEST -# KDE4_ADD_TEST_EXECUTABLE # KDE4_ADD_EXECUTABLE # KDE4_ADD_WIDGET_FILES # KDE4_UPDATE_ICONCACHE @@ -607,9 +606,13 @@ endmacro (KDE4_ADD_PLUGIN _target_NAME _with_PREFIX) # if "RUN_UNINSTALLED" is in the list of files, the _uninst argument is set to # "RUN_UNINSTALLED" (which evaluates to TRUE in cmake), otherwise it is set empty # (which evaluates to FALSE in cmake) -macro(KDE4_CHECK_EXECUTABLE_PARAMS _output_LIST _nogui _uninst) +# if "TEST" is in the list of files, the _test argument is set to +# "TEST" (which evaluates to TRUE in cmake), otherwise it is set empty +# (which evaluates to FALSE in cmake) +macro(KDE4_CHECK_EXECUTABLE_PARAMS _output_LIST _nogui _uninst _test) set(${_nogui}) set(${_uninst}) + set(${_test}) set(${_output_LIST} ${ARGN}) list(LENGTH ${_output_LIST} count) @@ -642,6 +645,12 @@ macro(KDE4_CHECK_EXECUTABLE_PARAMS _output_LIST _nogui _uninst) set(remove 0;1) endif (${second_PARAM} STREQUAL "RUN_UNINSTALLED") + if (${first_PARAM} STREQUAL "TEST") + set(${_test} "TEST") + set(remove 0) + endif (${first_PARAM} STREQUAL "TEST") + + if (NOT "${remove}" STREQUAL "NOTFOUND") list(REMOVE_AT ${_output_LIST} ${remove}) endif (NOT "${remove}" STREQUAL "NOTFOUND") @@ -651,7 +660,7 @@ endmacro(KDE4_CHECK_EXECUTABLE_PARAMS) macro (KDE4_ADD_KDEINIT_EXECUTABLE _target_NAME ) - kde4_check_executable_params(_SRCS _nogui _uninst ${ARGN}) + kde4_check_executable_params(_SRCS _nogui _uninst _test ${ARGN}) # if (WIN32) # # under windows, just build a normal executable @@ -696,7 +705,7 @@ macro (KDE4_ADD_UNIT_TEST _test_NAME) set(_targetName ${ARGV2}) list(REMOVE_AT _srcList 0 1) endif( ${ARGV1} STREQUAL "TESTNAME" ) - kde4_add_test_executable( ${_test_NAME} ${_srcList} ) + kde4_add_executable( ${_test_NAME} TEST ${_srcList} ) if(NOT KDE4_TEST_OUTPUT) set(KDE4_TEST_OUTPUT plaintext) @@ -737,43 +746,14 @@ macro (KDE4_ADD_UNIT_TEST _test_NAME) endmacro (KDE4_ADD_UNIT_TEST) -# add an test executable -# it will be built with RPATH pointing to the build dir -# The targets are always created, but only built for the "all" -# target if the option KDE4_BUILD_TESTS is enabled. Otherwise the rules for the target -# are created but not built by default. You can build them by manually building the target. -# KDESRCDIR is set to the source directory of the test, this can be used with -# KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); to be able to use xmlgui -# and other things in the test, that normally require installation macro (KDE4_ADD_TEST_EXECUTABLE _target_NAME) - - set(_add_executable_param) - - if (NOT KDE4_BUILD_TESTS) - set(_add_executable_param EXCLUDE_FROM_ALL) - endif (NOT KDE4_BUILD_TESTS) - - set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - - set(_SRCS ${ARGN}) - kde4_handle_automoc(${_target_NAME} _SRCS) - add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS}) - - set_target_properties(${_target_NAME} PROPERTIES - COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}\\"" - SKIP_BUILD_RPATH FALSE - BUILD_WITH_INSTALL_RPATH FALSE) - - if (WIN32) - target_link_libraries(${_target_NAME} ${QT_QTMAIN_LIBRARY}) - endif (WIN32) - + MESSAGE(SEND_ERROR "KDE4_ADD_TEST_EXECUTABLE is deprecated use KDE4_ADD_EXECUTABLE(<target> TEST <files> instead") endmacro (KDE4_ADD_TEST_EXECUTABLE) macro (KDE4_ADD_EXECUTABLE _target_NAME) - kde4_check_executable_params( _SRCS _nogui _uninst ${ARGN}) + kde4_check_executable_params( _SRCS _nogui _uninst _test ${ARGN}) set(_add_executable_param) set(_type "GUI") @@ -794,9 +774,13 @@ macro (KDE4_ADD_EXECUTABLE _target_NAME) set(_add_executable_param) endif (_nogui) - if (_uninst) + if (_uninst OR _test) set(_type "RUN_UNINSTALLED") - endif (_uninst) + endif (_uninst OR _test) + + if (_test AND NOT KDE4_BUILD_TESTS) + set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL) + endif (_test AND NOT KDE4_BUILD_TESTS) kde4_handle_automoc(${_target_NAME} _SRCS) if (KDE4_ENABLE_FINAL) @@ -806,6 +790,10 @@ macro (KDE4_ADD_EXECUTABLE _target_NAME) add_executable(${_target_NAME} ${_add_executable_param} ${_SRCS}) endif (KDE4_ENABLE_FINAL) + if (_test) + set_target_properties(${_target_NAME} PROPERTIES COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}\\"") + endif (_test) + kde4_handle_rpath_for_executable(${_target_NAME} ${_type}) if (WIN32) |