cmake_minimum_required(VERSION 3.8 FATAL_ERROR) option(TESTS_WITH_SANITIZERS "Enable sanitizers for tests." ON) find_package(Catch2 REQUIRED) if(TESTS_WITH_SANITIZERS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover") set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover") endif() add_executable(tests main.cpp ringbuffer.cpp packet.cpp parser.cpp button.cpp rand.cpp) target_link_libraries(tests PUBLIC skullc::utility skullc::messaging skullc::peripherals Catch2::Catch2 ) include(CTest) include(Catch) catch_discover_tests(tests)