-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
57 lines (45 loc) · 1.36 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
45
46
47
48
49
50
51
52
53
54
55
56
57
cmake_minimum_required(VERSION 3.25)
project(functional VERSION 0.0.1 LANGUAGES C CXX)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
option(DISABLE_FETCH_CONTENT "Do not use FetchContent for dependencies." OFF)
option(DISABLE_CCACHE_DETECTION "Do not use ccache as CMAKE_CXX_COMPILER_LAUNCHER." OFF)
option(COVERAGE "Enable coverage report." OFF)
option(DOCS "Generate documentation." OFF)
option(TESTS "Enable unit tests and examples." ON)
if(DOCS AND (NOT TESTS))
message(FATAL_ERROR "TESTS must be set if DOCS is set")
endif()
if(COVERAGE AND (NOT TESTS))
message(FATAL_ERROR "TESTS must be set if COVERAGE is set")
endif()
if(COVERAGE)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|(Apple)?Clang)")
include(CodeCoverage)
include(Coverage)
else()
message(FATAL_ERROR "COVERAGE not supported by compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
if (DOCS)
include(Docs)
endif()
include(Ccache)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(
-stdlib=libc++
)
add_link_options(
-lc++
)
endif()
add_subdirectory(include)
if(TESTS)
include(Catch2)
enable_testing()
add_subdirectory(tests)
endif()
install(FILES README.md LICENSE.md
DESTINATION share/doc/functional)