skullc-peripherals/Tests/CMakeLists.txt
Erki bb220c9e92
Some checks failed
continuous-integration/drone/push Build is failing
gitea/skullc-peripherals/pipeline/head There was a failure building this commit
Refactor cmake support to be less leaky
2022-06-16 23:19:51 +03:00

45 lines
1.1 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)
target_link_libraries(tests
PUBLIC
skullc::utility
skullc::messaging
skullc::peripherals
Catch2::Catch2
)
set_target_properties(tests
PROPERTIES
CXX_STANDARD 17
)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
include(CTest)
include(Catch)
catch_discover_tests(tests)