skullc-peripherals/Tests/CMakeLists.txt
2023-09-24 12:51:46 +03:00

54 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
option(SKULLC_TESTS_WITH_SANITIZERS "Enable sanitizers for tests." ON)
include(FetchContent)
FetchContent_Declare(Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.8
)
FetchContent_MakeAvailable(Catch2)
if(SKULLC_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
pixelbuffer_effects.cpp
function.cpp
assert_ndebug.cpp
assert.cpp
enum_helpers.cpp
bytes.cpp
filters.cpp
cpptick.cpp
)
target_link_libraries(tests
PUBLIC
skullc::utility
skullc::messaging
skullc::peripherals
Catch2::Catch2
skullc::cpptick
)
set_target_properties(tests
PROPERTIES
CXX_STANDARD 20
)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
include(CTest)
include(Catch)
catch_discover_tests(tests)