new: tests cmake setup

Signed-off-by: Lorenzo Fontana <lo@linux.com>
Co-authored-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Lorenzo Fontana 2019-06-25 10:33:38 +00:00 committed by Leo Di Donato
parent acae9dd9f1
commit 18b66330ec

24
tests/CMakeLists.txt Normal file
View File

@ -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()