]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/stl_interfaces/CMakeLists.txt
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / stl_interfaces / CMakeLists.txt
1 # Copyright (C) 2019 T. Zachary Laine
2 #
3 # Distributed under the Boost Software License, Version 1.0. (See
4 # accompanying file LICENSE_1_0.txt or copy at
5 # http://www.boost.org/LICENSE_1_0.txt)
6 cmake_minimum_required(VERSION 3.5)
7 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
8
9 project(stl_interfaces)
10
11 ##################################################
12 # C++ standard version selection
13 ##################################################
14 set(CXX_STD 14 CACHE STRING "Set to X to enable C++X builds.")
15 message("-- Using -std=c++${CXX_STD}")
16
17
18 ##################################################
19 # Sanitizers
20 ##################################################
21 set(USE_ASAN false CACHE BOOL "Set to true to enable -fsanitize=address when building tests.")
22 set(USE_UBSAN false CACHE BOOL "Set to true to enable -fsanitize=undefined when building tests.")
23 if (USE_ASAN AND USE_UBSAN)
24 message(FATAL_ERROR "USE_ASAN and USE_UBSAN must not be enabled at the same time")
25 elseif (USE_ASAN)
26 set(compile_flags -fsanitize=address)
27 set(link_flags -fsanitize=address)
28 message("-- Using -fsanitize=address")
29 elseif (USE_UBSAN)
30 set(compile_flags -fsanitize=undefined)
31 set(link_flags -fsanitize=undefined)
32 message("-- Using -fsanitize=undefined")
33 endif()
34
35
36 ##################################################
37 # Code coverage
38 ##################################################
39 if (UNIX)
40 set(BUILD_COVERAGE false CACHE BOOL "Set to true to enable code coverage when building tests. Only Linux and Mac are supported.")
41 if (BUILD_COVERAGE)
42 message("-- Building for code coverage; disabling any sanitizers")
43 if (APPLE)
44 set(compile_flags -fprofile-arcs -ftest-coverage)
45 set(CMAKE_BUILD_TYPE Debug)
46 set(link_flags --coverage)
47 else ()
48 set(compile_flags --coverage)
49 set(CMAKE_BUILD_TYPE Debug)
50 set(link_flags --coverage)
51 endif ()
52 endif ()
53 endif ()
54
55
56 ##################################################
57 # Dependencies
58 ##################################################
59 set(boost_components)
60 include(dependencies)
61
62 ##################################################
63 # stl_interfaces library
64 ##################################################
65 add_library(stl_interfaces INTERFACE)
66
67 target_include_directories(stl_interfaces INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
68 target_link_libraries(stl_interfaces INTERFACE boost)
69 if (link_flags)
70 target_link_libraries(stl_interfaces INTERFACE ${link_flags})
71 target_compile_options(stl_interfaces INTERFACE ${compile_flags})
72 endif ()
73 if (NOT MSVC)
74 target_compile_options(stl_interfaces INTERFACE -Wall)
75 endif ()
76
77
78 add_subdirectory(test)
79 add_subdirectory(example)