Optional tests
This commit is contained in:
parent
5afe852f75
commit
02053fb383
1 changed files with 11 additions and 7 deletions
|
@ -13,17 +13,21 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
|||
project(${PROJECT_NAME})
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
option(BUILD_ZECSY_TESTS "Build tests?" ON)
|
||||
|
||||
find_package(nlohmann_json)
|
||||
|
||||
add_library(zecsy STATIC zecsy.hpp)
|
||||
set_target_properties(zecsy PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
#######################################################
|
||||
find_package(Catch2 REQUIRED)
|
||||
file(GLOB TEST_SRC ./tests/*.cpp ./tests/*.hpp ./tests/*.h)
|
||||
add_executable(tests ${TEST_SRC})
|
||||
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain zecsy)
|
||||
if(${BUILD_ZECSY_TESTS})
|
||||
find_package(Catch2 REQUIRED)
|
||||
file(GLOB TEST_SRC ./tests/*.cpp ./tests/*.hpp ./tests/*.h)
|
||||
add_executable(tests ${TEST_SRC})
|
||||
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain zecsy)
|
||||
|
||||
include(CTest)
|
||||
include(Catch)
|
||||
catch_discover_tests(tests)
|
||||
include(CTest)
|
||||
include(Catch)
|
||||
catch_discover_tests(tests)
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue