-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
36 lines (30 loc) · 907 Bytes
/
CMakeLists.txt
File metadata and controls
36 lines (30 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 3.17)
project(cpp-nbt CXX)
set(RUN_COVERAGE OFF CACHE BOOL "Compile with coverage options")
if(MSVC)
set(WARNINGS /W4;/WX)
else()
set(WARNINGS -Wall;-Wextra;-pedantic;-Werror;-Wno-unused-value)
endif()
include_directories(${CMAKE_SOURCE_DIR})
include(CTest)
function(setup_test name)
set(target ${name}_bin)
add_executable(${target} tests/test_${name}.cpp)
target_compile_features(${target} PRIVATE cxx_std_23)
if(RUN_COVERAGE)
target_compile_options(${target} PRIVATE -fprofile-arcs;-ftest-coverage;-fno-inline)
target_link_options(${target} PRIVATE --coverage)
endif()
add_test(
NAME test_${name}
COMMAND ${CMAKE_BINARY_DIR}/${target}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/data
)
endfunction(setup_test)
setup_test(numerics)
setup_test(string)
setup_test(arrays)
setup_test(list)
setup_test(compound)
setup_test(misc)