-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
48 lines (33 loc) · 1.68 KB
/
Copy pathCMakeLists.txt
File metadata and controls
48 lines (33 loc) · 1.68 KB
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
# Generated by `boostdep --cmake safe_numbers`
# Copyright 2020, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.12...3.31)
project(boost_safe_numbers VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_safe_numbers INTERFACE)
add_library(Boost::safe_numbers ALIAS boost_safe_numbers)
target_include_directories(boost_safe_numbers INTERFACE include)
target_link_libraries(boost_safe_numbers
INTERFACE
Boost::charconv
Boost::core
Boost::throw_exception
)
target_compile_features(boost_safe_numbers INTERFACE cxx_std_20)
# Opt-in: turn provable compile-time-constant precondition violations (divide by zero,
# shift past type width, add/sub/mul overflow) into build errors. Only active on
# optimized GCC/Clang builds; a no-op elsewhere and at -O0. Propagated to consumers.
option(BOOST_SAFE_NUMBERS_ENABLE_COMPILE_ASSERT
"Turn provable constant precondition violations into build errors (optimized GCC/Clang only)" OFF)
if(BOOST_SAFE_NUMBERS_ENABLE_COMPILE_ASSERT)
target_compile_definitions(boost_safe_numbers INTERFACE BOOST_SAFE_NUMBERS_ENABLE_COMPILE_ASSERT)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()
# Opt-in benchmarks. Fetches Google Benchmark via FetchContent so the library
# stays self-contained and the benchmarks build the same way locally and in CI.
option(BOOST_SAFE_NUMBERS_BUILD_BENCHMARKS "Build the Boost.SafeNumbers benchmarks (fetches Google Benchmark)" OFF)
if(BOOST_SAFE_NUMBERS_BUILD_BENCHMARKS)
add_subdirectory(test/benchmarks)
endif()