Use Catch for our test suite

`make check` is also added to compile and run the tests
Catch is fetched with cmake automatically into the build directory when needed
This commit is contained in:
Florent Le Coz
2015-10-29 02:32:57 +01:00
parent 4e32fe213c
commit 3c1889fbd0
15 changed files with 625 additions and 555 deletions
+19 -3
View File
@@ -145,12 +145,13 @@ if(SYSTEMD_FOUND)
target_link_libraries(xmpp ${SYSTEMD_LIBRARIES})
endif()
#
## Tests
#
file(GLOB source_tests
tests/*.cpp)
add_executable(test_suite EXCLUDE_FROM_ALL
src/test.cpp)
${source_tests})
target_link_libraries(test_suite
xmpplib
xmpp
@@ -160,11 +161,26 @@ target_link_libraries(test_suite
config
logger
network)
if(USE_DATABASE)
target_link_libraries(test_suite
database)
endif()
include(ExternalProject)
ExternalProject_Add(catch
GIT_REPOSITORY "https://github.com/philsquared/Catch.git"
PREFIX "external"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(catch SOURCE_DIR)
target_include_directories(test_suite
PUBLIC "${SOURCE_DIR}/include/"
)
add_dependencies(test_suite catch)
add_custom_target(check COMMAND "test_suite"
DEPENDS test_suite)
#
## Install target