-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (32 loc) · 1.12 KB
/
CMakeLists.txt
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
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.21)
project(result)
set(CMAKE_CXX_STANDARD 17)
option(RESULT_ENABLE_TESTS "Enable test targets.")
include(cmake/CPM.cmake)
if(PROJECT_IS_TOP_LEVEL AND RESULT_ENABLE_TESTS)
cpmaddpackage(gh:threeal/CheckWarning.cmake@3.2.0)
add_check_warning(TREAT_WARNINGS_AS_ERRORS)
endif()
cpmaddpackage(gh:threeal/errors-cpp@1.0.0)
add_library(result INTERFACE)
target_include_directories(result INTERFACE include)
target_link_libraries(result INTERFACE errors)
if(PROJECT_IS_TOP_LEVEL)
cpmaddpackage(
GITHUB_REPOSITORY TheLartians/Format.cmake
VERSION 1.8.0
OPTIONS "FORMAT_SKIP_CMAKE ON"
)
if(RESULT_ENABLE_TESTS)
enable_testing()
cpmaddpackage(gh:catchorg/Catch2@3.7.1)
include("${Catch2_SOURCE_DIR}/extras/Catch.cmake")
if(NOT MSVC)
# set coverage flags (not supported in MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fPIC -O0")
endif()
add_executable(result_test test/result_test.cpp)
target_link_libraries(result_test PRIVATE result Catch2::Catch2WithMain)
catch_discover_tests(result_test)
endif()
endif()