From 18b66330ec209872c9204f1563ff244c751dbe14 Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Tue, 25 Jun 2019 10:33:38 +0000 Subject: [PATCH] new: tests cmake setup Signed-off-by: Lorenzo Fontana Co-authored-by: Leonardo Di Donato --- tests/CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/CMakeLists.txt diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..64ff0aa8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,24 @@ +set(FALCO_TESTS_SOURCES + TestBase.cpp) + +set(FALCO_TESTED_LIBRARIES + falco_engine) + +option(FALCO_BUILD_TESTS "Determines whether to build tests." OFF) + +if(FALCO_BUILD_TESTS) + enable_testing() + if(NOT TARGET catch) + include(FindCatch) + endif() + + add_executable(falco_test ${FALCO_TESTS_SOURCES}) + + target_link_libraries(falco_test PUBLIC ${FALCO_TESTED_LIBRARIES} catch) + + include(CTest) + include(Catch) + catch_discover_tests(falco_test) + + add_custom_target(tests COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS falco_test) +endif()