mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
cmake: don't always build tests
Only build the tests when running them. The downside of the way this is implemented is that build errors for the tests actually show up as test errors and are only seen in the test log - but this seemed worth not having every build include the tests. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
38ba7177c7
commit
ac34413a35
1 changed files with 5 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue