Use ecm_add_test(s) instead of own macro

This also fixes running 'nmake test' on Windows.
wilder
Alex Richardson 12 years ago
parent 6bb0a14db4
commit a3d6957ec5
  1. 68
      autotests/CMakeLists.txt
  2. 19
      autotests/kconfig_compiler/CMakeLists.txt

@ -1,7 +1,7 @@
remove_definitions(-DQT_NO_CAST_FROM_ASCII) remove_definitions(-DQT_NO_CAST_FROM_ASCII)
include(ECMMarkAsTest) include(ECMAddTests)
find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET) find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
find_package(Qt5Concurrent ${REQUIRED_QT_VERSION} CONFIG QUIET) find_package(Qt5Concurrent ${REQUIRED_QT_VERSION} CONFIG QUIET)
@ -16,54 +16,40 @@ if(NOT Qt5Concurrent_FOUND)
return() return()
endif() endif()
macro(KCONFIGCORE_UNIT_TESTS) ecm_add_tests(
foreach(_testname ${ARGN}) kconfignokdehometest.cpp
add_executable(${_testname} ${_testname}.cpp) # TODO NOGUI kconfigtest.cpp
add_test(kconfigcore-${_testname} ${_testname}) kdesktopfiletest.cpp
target_link_libraries(${_testname} KF5::ConfigCore Qt5::Test Qt5::Concurrent) ksharedconfigtest.cpp
ecm_mark_as_test(${_testname}) test_kconf_update.cpp
endforeach() NAME_PREFIX kconfigcore-
endmacro() LINK_LIBRARIES KF5::ConfigCore Qt5::Test Qt5::Concurrent
macro(KCONFIGGUI_UNIT_TESTS)
foreach(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp)
add_test(kconfiggui-${_testname} ${_testname})
target_link_libraries(${_testname} KF5::ConfigGui Qt5::Test)
ecm_mark_as_test(${_testname})
endforeach()
endmacro()
kconfigcore_unit_tests(
kconfignokdehometest
kconfigtest
kdesktopfiletest
ksharedconfigtest
test_kconf_update
) )
target_include_directories(test_kconf_update PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../src/kconf_update) target_include_directories(kconfigcore-test_kconf_update PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../src/kconf_update)
# compile KEntryMap into the test since it's not exported # compile KEntryMap into the test since it's not exported
set(kentrymaptest_SRCS kentrymaptest.cpp ../src/core/kconfigdata.cpp) set(kentrymaptest_SRCS kentrymaptest.cpp ../src/core/kconfigdata.cpp)
add_executable(kentrymaptest ${kentrymaptest_SRCS}) ecm_add_test(${kentrymaptest_SRCS}
add_test(kconfigcore-kentrymaptest kentrymaptest) TEST_NAME kconfigcore-kentrymaptest
target_link_libraries(kentrymaptest KF5::ConfigCore Qt5::Test) LINK_LIBRARIES KF5::ConfigCore Qt5::Test
ecm_mark_as_test(kentrymaptest) )
# compile KConfigUtils into the test since it's not exported # compile KConfigUtils into the test since it's not exported
set(test_kconfigutils_SRCS test_kconfigutils ../src/kconf_update/kconfigutils.cpp) set(test_kconfigutils_SRCS test_kconfigutils ../src/kconf_update/kconfigutils.cpp)
add_executable(test_kconfigutils ${test_kconfigutils_SRCS}) ecm_add_test(${test_kconfigutils_SRCS}
add_test(kconfigcore-test_kconfigutils test_kconfigutils) TEST_NAME kconfigcore-test_kconfigutils
target_link_libraries(test_kconfigutils KF5::ConfigCore Qt5::Test) LINK_LIBRARIES KF5::ConfigCore Qt5::Test
target_include_directories(test_kconfigutils PRIVATE ../src/kconf_update) )
ecm_mark_as_test(test_kconfigutils) target_include_directories(kconfigcore-test_kconfigutils PRIVATE ../src/kconf_update)
kconfiggui_unit_tests( ecm_add_tests(
kconfigguitest kconfigguitest.cpp
kconfigloadertest kconfigloadertest.cpp
kconfigskeletontest kconfigskeletontest.cpp
kstandardshortcuttest kstandardshortcuttest.cpp
NAME_PREFIX kconfiggui-
LINK_LIBRARIES KF5::ConfigGui Qt5::Test
) )
add_subdirectory(kconfig_compiler) add_subdirectory(kconfig_compiler)

@ -204,19 +204,18 @@ gen_kcfg_test_source(signals_test_singleton kconfigcompiler_test_signals_SRCS KC
gen_kcfg_test_source(signals_test_no_singleton kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg) gen_kcfg_test_source(signals_test_no_singleton kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
gen_kcfg_test_source(signals_test_singleton_dpointer kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg) gen_kcfg_test_source(signals_test_singleton_dpointer kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
gen_kcfg_test_source(signals_test_no_singleton_dpointer kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg) gen_kcfg_test_source(signals_test_no_singleton_dpointer kconfigcompiler_test_signals_SRCS KCFG signals_test.kcfg)
add_executable(kconfigcompiler_test_signals ${kconfigcompiler_test_signals_SRCS})
ecm_mark_as_test(kconfigcompiler_test_signals)
target_link_libraries(kconfigcompiler_test_signals Qt5::Test KF5::ConfigGui)
add_test(kconfig-kconfigcompiler-signals kconfigcompiler_test_signals)
########### next target ############### ecm_add_test(${kconfigcompiler_test_signals_SRCS}
TEST_NAME kconfigcompiler-signals-test
LINK_LIBRARIES Qt5::Test KF5::ConfigGui
)
set(kconfigcompiler_test_SRCS kconfigcompiler_test.cpp ) ########### next target ###############
add_executable(kconfigcompiler_test ${kconfigcompiler_test_SRCS})
ecm_mark_as_test(kconfigcompiler_test)
add_test(kconfig-kconfigcompiler kconfigcompiler_test)
target_link_libraries(kconfigcompiler_test Qt5::Test ) ecm_add_test(kconfigcompiler_test.cpp
TEST_NAME kconfigcompiler-basic-test
LINK_LIBRARIES Qt5::Test
)
########### install files ############### ########### install files ###############

Loading…
Cancel
Save