Use ctest

This commit is contained in:
Petr Mrázek 2013-12-14 14:17:59 +01:00
parent 8f856f5573
commit f15306a0ac
3 changed files with 6 additions and 8 deletions

View File

@ -6,6 +6,7 @@ IF(WIN32)
ENDIF()
project(MultiMC)
enable_testing()
######## Set CMake options ########
SET(CMAKE_AUTOMOC ON)

View File

@ -34,7 +34,7 @@ macro(ADD_UPDATER_TEST CLASS)
set(TEST_TARGET updater_${CLASS})
add_executable(${TEST_TARGET} ${CLASS}.cpp)
target_link_libraries(${TEST_TARGET} updatershared)
add_test(${TEST_TARGET} ${TEST_TARGET})
add_test(NAME ${TEST_TARGET} COMMAND ${TEST_TARGET})
if (APPLE)
set_target_properties(${TEST_TARGET} PROPERTIES LINK_FLAGS "-framework Security -framework Cocoa")
endif()

View File

@ -1,3 +1,4 @@
# run the unit tests with `make test`
find_package(Qt5 COMPONENTS Test Core Network Widgets)
include_directories(${MMC_SRC})
@ -11,18 +12,14 @@ macro(add_unit_test name)
add_executable(tst_${name} ${srcs})
qt5_use_modules(tst_${name} Test Core Network Widgets)
target_link_libraries(tst_${name} MultiMC_common)
add_test(tst_${name} tst_${name})
list(APPEND MultiMC_TESTS tst_${name})
endmacro()
macro(add_unit_test2 name)
add_unit_test(${name} tst_${name}.cpp)
add_test(NAME ${name} COMMAND tst_${name})
endmacro()
# Tests START #
add_unit_test2(pathutils)
add_unit_test2(userutils)
add_unit_test(pathutils tst_pathutils.cpp)
add_unit_test(userutils tst_userutils.cpp)
# Tests END #