summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39d09a5b1..e4c5cc4a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -361,15 +361,17 @@ endif()
# QTest based tests
macro(TEST NAME FILE)
- add_executable(${NAME} tests/${FILE} ${SUBSURFACE_RESOURCES})
+ add_executable(${NAME} EXCLUDE_FROM_ALL tests/${FILE} ${SUBSURFACE_RESOURCES})
target_link_libraries(${NAME} subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES})
- add_test(NAME ${NAME} COMMAND ${NAME})
+ add_test(NAME ${NAME}_build COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${NAME})
+ add_test(NAME ${NAME}_run COMMAND ${NAME})
+ set_tests_properties(${NAME}_run PROPERTIES DEPENDS ${NAME}_build)
endmacro()
-enable_testing()
add_definitions(-DSUBSURFACE_SOURCE="${CMAKE_SOURCE_DIR}")
add_definitions(-g)
if(NOT NO_TESTS)
+ enable_testing()
TEST(TestUnitConversion testunitconversion.cpp)
TEST(TestProfile testprofile.cpp)
TEST(TestGpsCoords testgpscoords.cpp)