summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-09-03 17:10:50 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-30 10:36:49 -0700
commit044e593957acc8de045c02003fa468bd76c98767 (patch)
tree103e087ec6cf1b594c0ad0db1fab3430c5c4ff9a /CMakeLists.txt
parent1d6683f3e07d9a73af5fab702bc3a551ec7dabc9 (diff)
downloadsubsurface-044e593957acc8de045c02003fa468bd76c98767.tar.gz
CMake for tests in its own folder
Besides making it more simple to add a new test now since you don't need to play hide and seek with the main cmake this has another good thing: on IDE's that scan the cmake to create targets on the project tree, the main project was being popullated with test-targets on the main tree and not inside the tests directory. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt31
1 files changed, 6 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5b0195a6..7abe3d6c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,8 @@ option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
option(LIBGRANTLEE_FROM_PKGCONFIG "use pkg-config to retrieve grantlee" OFF)
option(LIBMARBLE_FROM_PKGCONFIG "use pkg-config to retrieve marble" OFF)
+option(MAKE_TESTS "Make the tests" ON)
option(NO_MARBLE "disable the marble widget" OFF)
-option(NO_TESTS "disable the tests" OFF)
option(NO_DOCS "disable the docs" OFF)
option(NO_PRINTING "disable the printing support" OFF)
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
@@ -340,7 +340,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ANDROID)
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} -lpthread)
endif()
-
# create the executables
if(SUBSURFACE_MOBILE)
set(MOBILE_SRC
@@ -410,29 +409,6 @@ endif()
add_executable(export-html EXCLUDE_FROM_ALL export-html.cpp ${SUBSURFACE_RESOURCES})
target_link_libraries(export-html subsurface_corelib ${SUBSURFACE_LINK_LIBRARIES})
-# QTest based tests
-macro(TEST NAME FILE)
- 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}_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()
-
-
-add_definitions(-g)
-if(NOT NO_TESTS)
- enable_testing()
- 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)
-endif()
-
# install a few things so that one can run Subsurface from the build
# directory
if(NOT insource)
@@ -661,7 +637,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
)
endif()
endif()
+
# get_cmake_property(_variableNames VARIABLES)
# foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()
+
+if (MAKE_TESTS)
+ add_subdirectory(tests)
+endif()