]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/boost_install/BoostConfig.cmake
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / tools / boost_install / BoostConfig.cmake
1 # Copyright 2019 Peter Dimov
2 # Distributed under the Boost Software License, Version 1.0.
3 # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
4
5 # This CMake configuration file, installed as part of the Boost build
6 # and installation procedure done by `b2 install`, provides support
7 # for find_package(Boost).
8 #
9 # It's roughly, but not perfectly, compatible with the behavior
10 # of find_package(Boost) as provided by FindBoost.cmake.
11 #
12 # A typical use might be
13 #
14 # find_package(Boost 1.70 REQUIRED COMPONENTS filesystem regex PATHS C:/Boost)
15 #
16 # On success, the above invocation would define the targets Boost::headers,
17 # Boost::filesystem and Boost::regex. Boost::headers represents all
18 # header-only libraries. An alias, Boost::boost, for Boost::headers is
19 # provided for compatibility.
20 #
21 # Since Boost libraries can coexist in many variants - 32/64 bit,
22 # static/dynamic runtime, debug/release, the following variables can be used
23 # to control which variant is chosen:
24 #
25 # Boost_USE_DEBUG_LIBS: When OFF, disables debug libraries.
26 # Boost_USE_RELEASE_LIBS: When OFF, disables release libraries.
27 # Boost_USE_MULTITHREADED: When ON, uses multithreaded Boost libraries.
28 # When OFF, uses single-threaded libraries.
29 # The default is to use either.
30 # Boost_USE_STATIC_LIBS: When ON, uses static Boost libraries; when OFF,
31 # uses shared Boost libraries; when not set, uses
32 # static on Windows, shared otherwise.
33 # Boost_USE_STATIC_RUNTIME: When ON, uses Boost libraries linked against the
34 # static runtime. The default is shared runtime.
35 # Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the
36 # debug runtime. When OFF, against the release
37 # runtime. The default is to use either.
38 # Boost_COMPILER: The compiler that has been used to build Boost,
39 # such as vc141, gcc7, clang37. The default is
40 # determined from CMAKE_CXX_COMPILER_ID.
41 # Boost_PYTHON_VERSION: The version of Python against which Boost.Python
42 # has been built; only required when more than one
43 # Boost.Python library is present.
44 #
45 # The following variables control the verbosity of the output:
46 #
47 # Boost_VERBOSE: Enable verbose output
48 # Boost_DEBUG: Enable debug (even more verbose) output
49
50 if(Boost_VERBOSE OR Boost_DEBUG)
51
52 message(STATUS "Found Boost ${Boost_VERSION} at ${Boost_DIR}")
53
54 # Output requested configuration (f.ex. "REQUIRED COMPONENTS filesystem")
55
56 if(Boost_FIND_QUIETLY)
57 set(_BOOST_CONFIG "${_BOOST_CONFIG} QUIET")
58 endif()
59
60 if(Boost_FIND_REQUIRED)
61 set(_BOOST_CONFIG "${_BOOST_CONFIG} REQUIRED")
62 endif()
63
64 foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)
65 if(${Boost_FIND_REQUIRED_${__boost_comp}})
66 list(APPEND _BOOST_COMPONENTS ${__boost_comp})
67 else()
68 list(APPEND _BOOST_OPTIONAL_COMPONENTS ${__boost_comp})
69 endif()
70 endforeach()
71
72 if(_BOOST_COMPONENTS)
73 set(_BOOST_CONFIG "${_BOOST_CONFIG} COMPONENTS ${_BOOST_COMPONENTS}")
74 endif()
75
76 if(_BOOST_OPTIONAL_COMPONENTS)
77 set(_BOOST_CONFIG "${_BOOST_CONFIG} OPTIONAL_COMPONENTS ${_BOOST_OPTIONAL_COMPONENTS}")
78 endif()
79
80 if(_BOOST_CONFIG)
81 message(STATUS " Requested configuration:${_BOOST_CONFIG}")
82 endif()
83
84 unset(_BOOST_CONFIG)
85 unset(_BOOST_COMPONENTS)
86 unset(_BOOST_OPTIONAL_COMPONENTS)
87
88 endif()
89
90 macro(boost_find_component comp req)
91
92 set(_BOOST_QUIET)
93 if(Boost_FIND_QUIETLY)
94 set(_BOOST_QUIET QUIET)
95 endif()
96
97 set(_BOOST_REQUIRED)
98 if(${req} AND Boost_FIND_REQUIRED)
99 set(_BOOST_REQUIRED REQUIRED)
100 endif()
101
102 if("${comp}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$")
103
104 # handle pythonXY and numpyXY versioned components for compatibility
105
106 set(Boost_PYTHON_VERSION "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
107 set(__boost_comp_nv "${CMAKE_MATCH_1}")
108
109 else()
110
111 set(__boost_comp_nv "${comp}")
112
113 endif()
114
115 get_filename_component(_BOOST_CMAKEDIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
116
117 if(Boost_DEBUG)
118 message(STATUS "BoostConfig: find_package(boost_${__boost_comp_nv} ${Boost_VERSION} EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})")
119 endif()
120 find_package(boost_${__boost_comp_nv} ${Boost_VERSION} EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})
121
122 set(__boost_comp_found ${boost_${__boost_comp_nv}_FOUND})
123
124 # FindPackageHandleStandardArgs expects <package>_<component>_FOUND
125 set(Boost_${comp}_FOUND ${__boost_comp_found})
126
127 # FindBoost sets Boost_<COMPONENT>_FOUND
128 string(TOUPPER ${comp} _BOOST_COMP)
129 set(Boost_${_BOOST_COMP}_FOUND ${__boost_comp_found})
130
131 # FindBoost compatibility variables: Boost_LIBRARIES, Boost_<C>_LIBRARY
132 if(__boost_comp_found)
133
134 list(APPEND Boost_LIBRARIES Boost::${__boost_comp_nv})
135 set(Boost_${_BOOST_COMP}_LIBRARY Boost::${__boost_comp_nv})
136
137 if(NOT "${comp}" STREQUAL "${__boost_comp_nv}" AND NOT TARGET Boost::${comp})
138
139 # Versioned target alias (f.ex. Boost::python27) for compatibility
140 add_library(Boost::${comp} INTERFACE IMPORTED)
141 set_property(TARGET Boost::${comp} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Boost::${__boost_comp_nv})
142
143 endif()
144
145 endif()
146
147 unset(_BOOST_REQUIRED)
148 unset(_BOOST_QUIET)
149 unset(_BOOST_CMAKEDIR)
150 unset(__boost_comp_nv)
151 unset(__boost_comp_found)
152 unset(_BOOST_COMP)
153
154 endmacro()
155
156 # Find boost_headers
157
158 boost_find_component(headers 1)
159
160 if(NOT boost_headers_FOUND)
161
162 set(Boost_FOUND 0)
163 set(Boost_NOT_FOUND_MESSAGE "A required dependency, boost_headers, has not been found.")
164
165 return()
166
167 endif()
168
169 # Compatibility variables
170
171 set(Boost_MAJOR_VERSION ${Boost_VERSION_MAJOR})
172 set(Boost_MINOR_VERSION ${Boost_VERSION_MINOR})
173 set(Boost_SUBMINOR_VERSION ${Boost_VERSION_PATCH})
174
175 set(Boost_VERSION_STRING ${Boost_VERSION})
176 set(Boost_VERSION_MACRO ${Boost_VERSION_MAJOR}0${Boost_VERSION_MINOR}0${Boost_VERSION_PATCH})
177
178 get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
179 set(Boost_LIBRARIES "")
180
181 # Find components
182
183 foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)
184
185 boost_find_component(${__boost_comp} ${Boost_FIND_REQUIRED_${__boost_comp}})
186
187 endforeach()
188
189 # Compatibility targets
190
191 if(NOT TARGET Boost::boost)
192
193 add_library(Boost::boost INTERFACE IMPORTED)
194 set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_LINK_LIBRARIES Boost::headers)
195
196 # All Boost:: targets already disable autolink
197 add_library(Boost::diagnostic_definitions INTERFACE IMPORTED)
198 add_library(Boost::disable_autolinking INTERFACE IMPORTED)
199 add_library(Boost::dynamic_linking INTERFACE IMPORTED)
200
201 endif()