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