-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
78 lines (57 loc) · 2.1 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
cmake_minimum_required(VERSION 3.28)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # For external tools
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# ---------------------------------------
# Project
# ---------------------------------------
option(BRWT_INCLUDE_TESTS "Generate build targets for the BRWT unit tests." ON)
option(BRWT_BUILD_TESTS "Include unit test targets in the default build target." OFF)
option(BRWT_INCLUDE_BENCHMARKS "Generate build targets for the BRWT benchmark tests." OFF)
option(BRWT_BUILD_BENCHMARKS "Include benchmark targets in the default build target." OFF)
option(BRWT_INCLUDE_DOCS "Generate build targets for the BRWT documentation." ON)
option(BRWT_ENABLE_MODULES "Enable support for clang modules." OFF)
option(BRWT_ENABLE_LTO "Enable link time optimization." OFF)
# Autoselect vcpkg features based on selected options. If Vcpkg is not in use,
# VCPKG_MANIFEST_FEATURES is just ignored.
if(BRWT_INCLUDE_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif()
if(BRWT_INCLUDE_BENCHMARKS)
list(APPEND VCPKG_MANIFEST_FEATURES "benchmarks")
endif()
project("binrel_wt" CXX)
# ---------------------------------------
# Handle compilation options
# ---------------------------------------
if(BRWT_ENABLE_MODULES)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-fmodules -fcxx-modules)
add_compile_options(-Wno-non-modular-include-in-module) # for <cassert>
endif()
endif()
include(HandleOptions)
include(AddBRWT)
# ---------------------------------------
# Add subdirectories
# ---------------------------------------
add_subdirectory("lib")
if(BRWT_INCLUDE_TESTS)
enable_testing()
add_subdirectory("test")
include(CTest)
endif()
if(BRWT_INCLUDE_BENCHMARKS)
add_subdirectory("benchmarks")
endif()
if(BRWT_INCLUDE_DOCS)
add_subdirectory("docs")
endif()
# ---------------------------------------
# Install include headers
# ---------------------------------------
install(DIRECTORY "include/brwt"
DESTINATION "include"
FILES_MATCHING PATTERN "*.h")