summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
blob: 9336424eb8ad58d7506fb893e21b3229d1c30bc3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# QTest based tests
qt5_add_resources(SUBSURFACE_TEST_RESOURCES ../subsurface.qrc)

# Access test data (dive folder) from SUBSURFACE_SOURCE by default.
# In cross compilation cases or when test will not be executed at build time
# a differnt value can be set via cmake -DSUBSURFACE_TEST_DATA.
if(NOT SUBSURFACE_TEST_DATA)
  set(SUBSURFACE_TEST_DATA ${SUBSURFACE_SOURCE})
endif()

add_library(RESOURCE_LIBRARY STATIC ${SUBSURFACE_TEST_RESOURCES})

macro(TEST NAME FILE)
	add_executable(${NAME} ${FILE} )
	target_link_libraries(${NAME} subsurface_corelib RESOURCE_LIBRARY ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} )
	add_test(NAME ${NAME} COMMAND  $<TARGET_FILE:${NAME}>)
endmacro()

enable_testing()
add_definitions(-g)
add_definitions(-DSUBSURFACE_TEST_DATA="${SUBSURFACE_TEST_DATA}")
TEST(TestUnitConversion testunitconversion.cpp)
TEST(TestProfile testprofile.cpp)
TEST(TestGpsCoords testgpscoords.cpp)
TEST(TestParse testparse.cpp)
TEST(TestPlan testplan.cpp)
TEST(TestDiveSiteDuplication testdivesiteduplication.cpp)
TEST(TestRenumber testrenumber.cpp)
TEST(TestGitStorage testgitstorage.cpp)
TEST(TestPreferences testpreferences.cpp)
TEST(TestPicture testpicture.cpp)
TEST(TestMerge testmerge.cpp)


add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
	DEPENDS
	TestUnitConversion
	TestProfile
	TestGpsCoords
	TestParse
	TestGitStorage
	TestPlan
	TestDiveSiteDuplication
	TestPreferences
	TestRenumber
	TestPicture
	TestMerge
)

# useful for debugging CMake issues
# print_all_variables()