aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2007-01-23 22:37:17 +0000
committerThiago Macieira <thiago@kde.org>2007-01-23 22:37:17 +0000
commita4c4ea7ce9083b4b56248f34a16f587e8a30203d (patch)
tree6b06d91c639e2d2f3b560f4cc67c78f0e0332c6e /modules
parentf73f26c32e55dfce4f54cfa00291309afb3aab01 (diff)
downloadextra-cmake-modules-a4c4ea7ce9083b4b56248f34a16f587e8a30203d.tar.gz
extra-cmake-modules-a4c4ea7ce9083b4b56248f34a16f587e8a30203d.tar.bz2
Add macro KDE4_ADD_TEST for unit test usage. This way, if you have
CMake 2.4.4 or later, you don't need to turn on KDE4_BUILD_TESTS to be allowed to build tests: just cd into the tests dir and "make targetname". PS: it's time we bumped the minimum version requirement for CMake... CCMAIL:kde-buildsystem@kde.org svn path=/trunk/KDE/kdelibs/; revision=626619
Diffstat (limited to 'modules')
-rw-r--r--modules/KDE4Macros.cmake33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/KDE4Macros.cmake b/modules/KDE4Macros.cmake
index af9c6f60..95718bae 100644
--- a/modules/KDE4Macros.cmake
+++ b/modules/KDE4Macros.cmake
@@ -663,6 +663,39 @@ macro (KDE4_ADD_KDEINIT_EXECUTABLE _target_NAME )
endmacro (KDE4_ADD_KDEINIT_EXECUTABLE)
+macro (KDE4_ADD_TEST _target_NAME)
+
+ MATH(EXPR cmake_version "${CMAKE_MAJOR_VERSION} * 10000 + ${CMAKE_MINOR_VERSION} * 100 + ${CMAKE_PATCH_VERSION}")
+
+ set(_add_executable_param)
+ set(_go)
+ if (KDE4_BUILD_TESTS)
+ set(_go TRUE)
+ else (KDE4_BUILD_TESTS)
+ if (cmake_version GREATER 20403)
+ set(_go TRUE)
+ set(_add_executable_param EXCLUDE_FROM_ALL)
+ endif (cmake_version GREATER 20403)
+ endif (KDE4_BUILD_TESTS)
+
+ if (_go)
+ kde4_get_automoc_files(_automoc_FILES ${ARGN})
+
+ add_executable(${_target_NAME} ${_add_executable_param} ${ARGN} ${_automoc_FILES})
+
+ set_target_properties(${_target_NAME} PROPERTIES
+ EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}
+ DEFINITIONS -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)
+
+ endif (_go)
+endmacro (KDE4_ADD_TEST)
+
macro (KDE4_ADD_EXECUTABLE _target_NAME)
kde4_check_executable_params( _SRCS _nogui _uninst ${ARGN})