-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
56 lines (48 loc) · 2.3 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
# CMake>=3.25 is required for `add_subdirectory(... SYSTEM)`, which is convenient for
# working with Git submodules. The maximum version may be updated occasionally but
# should not exceed the latest CMake version tested by the CI system.
cmake_minimum_required(VERSION 3.25...3.30)
# This project follows a CalVer (calendar date-based versioning) convention with two
# version numbers. The first is the "epoch" -- the calendar date of the latest
# API-breaking release in YYYYMMDD format. Each release with the same epoch number
# should be API-compatible. The second version number is the "patch" number, which is
# incremented whenever backwards-compatible patches are released, starting over from 0
# whenever the epoch is updated.
project(
whirlwind
VERSION 20240715.0
LANGUAGES CXX
)
# Optionally build the test suite. Defaults to ON if this is the main (top-level) CMake
# project; otherwise OFF.
option(WHIRLWIND_TEST "Build the test suite" ${PROJECT_IS_TOP_LEVEL})
# Converts compiler warnings into errors. Enabled by default but may be disabled for
# developing new features, testing new compilers, etc.
option(WHIRLWIND_FATAL_WARNINGS "Turn warnings into errors" ON)
# Add third-party submodules.
add_subdirectory(ext SYSTEM)
# Create a `version.hpp` file in the source tree from the input `version.hpp.in`
# template file when CMake configures the project.
configure_file(
${CMAKE_CURRENT_LIST_DIR}/include/whirlwind/common/version.hpp.in
${CMAKE_CURRENT_LIST_DIR}/include/whirlwind/common/version.hpp @ONLY
)
add_library(whirlwind INTERFACE)
add_library(whirlwind::whirlwind ALIAS whirlwind)
target_compile_features(whirlwind INTERFACE cxx_std_20)
target_include_directories(
whirlwind INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include/>
)
target_link_libraries(whirlwind INTERFACE range-v3::range-v3 std::generator std::mdspan)
# When compiling with GCC<11, we need to add the `-fcoroutines` option to enable
# coroutines support. With LLVM Clang<16, we need `-fcoroutines-ts` instead.
target_compile_options(
whirlwind
INTERFACE
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,11>>:-fcoroutines>
$<$<AND:$<COMPILE_LANG_AND_ID:CXX,Clang>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,16>>:-fcoroutines-ts>
)
if(WHIRLWIND_TEST)
include(CTest)
add_subdirectory(test)
endif()