skullc-peripherals/Tests/CMakeLists.txt
2021-05-15 21:36:12 +03:00

32 lines
802 B
CMake

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
fixedpoint.cpp
pixelbuffer.cpp)
target_link_libraries(tests
PUBLIC
skullc::utility
skullc::messaging
skullc::peripherals
Catch2::Catch2
)
include(CTest)
include(Catch)
catch_discover_tests(tests)