]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | # file Copyright.txt or https://cmake.org/licensing for details. | |
3 | ||
494da23a TL |
4 | #[=======================================================================[.rst: |
5 | FindBoost | |
6 | --------- | |
7 | ||
8 | Find Boost include dirs and libraries | |
9 | ||
10 | Use this module by invoking find_package with the form:: | |
11 | ||
12 | find_package(Boost | |
13 | [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0 | |
14 | [REQUIRED] # Fail with error if Boost is not found | |
15 | [COMPONENTS <libs>...] # Boost libraries by their canonical name | |
16 | # e.g. "date_time" for "libboost_date_time" | |
17 | [OPTIONAL_COMPONENTS <libs>...] | |
18 | # Optional Boost libraries by their canonical name) | |
19 | ) # e.g. "date_time" for "libboost_date_time" | |
20 | ||
21 | This module finds headers and requested component libraries OR a CMake | |
22 | package configuration file provided by a "Boost CMake" build. For the | |
23 | latter case skip to the "Boost CMake" section below. For the former | |
24 | case results are reported in variables:: | |
25 | ||
26 | Boost_FOUND - True if headers and requested libraries were found | |
27 | Boost_INCLUDE_DIRS - Boost include directories | |
28 | Boost_LIBRARY_DIRS - Link directories for Boost libraries | |
29 | Boost_LIBRARIES - Boost component libraries to be linked | |
30 | Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case) | |
31 | Boost_<C>_LIBRARY - Libraries to link for component <C> (may include | |
32 | target_link_libraries debug/optimized keywords) | |
92f5a8d4 | 33 | Boost_VERSION_MACRO - BOOST_VERSION value from boost/version.hpp |
494da23a | 34 | Boost_VERSION_STRING - Boost version number in x.y.z format |
92f5a8d4 TL |
35 | Boost_VERSION - if CMP0093 NEW => same as Boost_VERSION_STRING |
36 | if CMP0093 OLD or unset => same as Boost_VERSION_MACRO | |
37 | Boost_LIB_VERSION - Version string appended to library filenames | |
38 | Boost_VERSION_MAJOR - Boost major version number (X in X.y.z) | |
39 | alias: Boost_MAJOR_VERSION | |
40 | Boost_VERSION_MINOR - Boost minor version number (Y in x.Y.z) | |
41 | alias: Boost_MINOR_VERSION | |
42 | Boost_VERSION_PATCH - Boost subminor version number (Z in x.y.Z) | |
43 | alias: Boost_SUBMINOR_VERSION | |
44 | Boost_VERSION_COUNT - Amount of version components (3) | |
494da23a TL |
45 | Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) |
46 | - Pass to add_definitions() to have diagnostic | |
47 | information about Boost's automatic linking | |
48 | displayed during compilation | |
49 | ||
50 | Note that Boost Python components require a Python version suffix | |
51 | (Boost 1.67 and later), e.g. ``python36`` or ``python27`` for the | |
52 | versions built against Python 3.6 and 2.7, respectively. This also | |
53 | applies to additional components using Python including | |
54 | ``mpi_python`` and ``numpy``. Earlier Boost releases may use | |
55 | distribution-specific suffixes such as ``2``, ``3`` or ``2.7``. | |
56 | These may also be used as suffixes, but note that they are not | |
57 | portable. | |
58 | ||
59 | This module reads hints about search locations from variables:: | |
60 | ||
61 | BOOST_ROOT - Preferred installation prefix | |
62 | (or BOOSTROOT) | |
63 | BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include | |
64 | BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib | |
494da23a TL |
65 | Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not |
66 | specified by these hint variables. Default is OFF. | |
67 | Boost_ADDITIONAL_VERSIONS | |
68 | - List of Boost versions not known to this module | |
69 | (Boost install locations may contain the version) | |
70 | ||
71 | and saves search results persistently in CMake cache entries:: | |
72 | ||
73 | Boost_INCLUDE_DIR - Directory containing Boost headers | |
74 | Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries | |
75 | Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries | |
76 | Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant | |
77 | Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant | |
78 | ||
79 | The following :prop_tgt:`IMPORTED` targets are also defined:: | |
80 | ||
92f5a8d4 | 81 | Boost::headers - Target for header-only dependencies |
494da23a | 82 | (Boost include directory) |
92f5a8d4 | 83 | alias: Boost::boost |
494da23a TL |
84 | Boost::<C> - Target for specific component dependency |
85 | (shared or static library); <C> is lower- | |
86 | case | |
87 | Boost::diagnostic_definitions - interface target to enable diagnostic | |
88 | information about Boost's automatic linking | |
89 | during compilation (adds BOOST_LIB_DIAGNOSTIC) | |
90 | Boost::disable_autolinking - interface target to disable automatic | |
91 | linking with MSVC (adds BOOST_ALL_NO_LIB) | |
92 | Boost::dynamic_linking - interface target to enable dynamic linking | |
93 | linking with MSVC (adds BOOST_ALL_DYN_LINK) | |
94 | ||
92f5a8d4 TL |
95 | Implicit dependencies such as ``Boost::filesystem`` requiring |
96 | ``Boost::system`` will be automatically detected and satisfied, even | |
97 | if system is not specified when using :command:`find_package` and if | |
98 | ``Boost::system`` is not added to :command:`target_link_libraries`. If using | |
99 | ``Boost::thread``, then ``Threads::Threads`` will also be added automatically. | |
494da23a TL |
100 | |
101 | It is important to note that the imported targets behave differently | |
102 | than variables created by this module: multiple calls to | |
92f5a8d4 | 103 | :command:`find_package(Boost)` in the same directory or sub-directories with |
494da23a TL |
104 | different options (e.g. static or shared) will not override the |
105 | values of the targets created by the first call. | |
106 | ||
92f5a8d4 | 107 | Users may set these hints or results as ``CACHE`` entries. Projects |
494da23a TL |
108 | should not read these entries directly but instead use the above |
109 | result variables. Note that some hint names start in upper-case | |
110 | "BOOST". One may specify these as environment variables if they are | |
111 | not specified as CMake variables or cache entries. | |
112 | ||
92f5a8d4 TL |
113 | This module first searches for the ``Boost`` header files using the above |
114 | hint variables (excluding ``BOOST_LIBRARYDIR``) and saves the result in | |
115 | ``Boost_INCLUDE_DIR``. Then it searches for requested component libraries | |
116 | using the above hints (excluding ``BOOST_INCLUDEDIR`` and | |
117 | ``Boost_ADDITIONAL_VERSIONS``), "lib" directories near ``Boost_INCLUDE_DIR``, | |
494da23a | 118 | and the library name configuration settings below. It saves the |
92f5a8d4 TL |
119 | library directories in ``Boost_LIBRARY_DIR_DEBUG`` and |
120 | ``Boost_LIBRARY_DIR_RELEASE`` and individual library | |
121 | locations in ``Boost_<C>_LIBRARY_DEBUG`` and ``Boost_<C>_LIBRARY_RELEASE``. | |
494da23a TL |
122 | When one changes settings used by previous searches in the same build |
123 | tree (excluding environment variables) this module discards previous | |
124 | search results affected by the changes and searches again. | |
125 | ||
126 | Boost libraries come in many variants encoded in their file name. | |
127 | Users or projects may tell this module which variant to find by | |
128 | setting variables:: | |
129 | ||
130 | Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search | |
131 | and use the debug libraries. Default is ON. | |
132 | Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search | |
133 | and use the release libraries. Default is ON. | |
134 | Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded | |
135 | libraries ('mt' tag). Default is ON. | |
136 | Boost_USE_STATIC_LIBS - Set to ON to force the use of the static | |
137 | libraries. Default is OFF. | |
138 | Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use | |
139 | libraries linked statically to the C++ runtime | |
140 | ('s' tag). Default is platform dependent. | |
141 | Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use | |
142 | libraries linked to the MS debug C++ runtime | |
143 | ('g' tag). Default is ON. | |
144 | Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a | |
145 | debug Python build ('y' tag). Default is OFF. | |
146 | Boost_USE_STLPORT - Set to ON to use libraries compiled with | |
147 | STLPort ('p' tag). Default is OFF. | |
148 | Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS | |
149 | - Set to ON to use libraries compiled with | |
150 | STLPort deprecated "native iostreams" | |
151 | ('n' tag). Default is OFF. | |
152 | Boost_COMPILER - Set to the compiler-specific library suffix | |
153 | (e.g. "-gcc43"). Default is auto-computed | |
154 | for the C++ compiler in use. A list may be | |
155 | used if multiple compatible suffixes should | |
156 | be tested for, in decreasing order of | |
157 | preference. | |
158 | Boost_ARCHITECTURE - Set to the architecture-specific library suffix | |
159 | (e.g. "-x64"). Default is auto-computed for the | |
160 | C++ compiler in use. | |
161 | Boost_THREADAPI - Suffix for "thread" component library name, | |
162 | such as "pthread" or "win32". Names with | |
163 | and without this suffix will both be tried. | |
164 | Boost_NAMESPACE - Alternate namespace used to build boost with | |
165 | e.g. if set to "myboost", will search for | |
166 | myboost_thread instead of boost_thread. | |
167 | ||
168 | Other variables one may set to control this module are:: | |
169 | ||
170 | Boost_DEBUG - Set to ON to enable debug output from FindBoost. | |
171 | Please enable this before filing any bug report. | |
494da23a TL |
172 | Boost_REALPATH - Set to ON to resolve symlinks for discovered |
173 | libraries to assist with packaging. For example, | |
174 | the "system" component library may be resolved to | |
175 | "/usr/lib/libboost_system.so.1.67.0" instead of | |
176 | "/usr/lib/libboost_system.so". This does not | |
177 | affect linking and should not be enabled unless | |
178 | the user needs this information. | |
179 | Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and | |
180 | Boost_LIBRARY_DIR_DEBUG. | |
181 | ||
182 | On Visual Studio and Borland compilers Boost headers request automatic | |
183 | linking to corresponding libraries. This requires matching libraries | |
184 | to be linked explicitly or available in the link library search path. | |
92f5a8d4 | 185 | In this case setting ``Boost_USE_STATIC_LIBS`` to ``OFF`` may not achieve |
494da23a | 186 | dynamic linking. Boost automatic linking typically requests static |
92f5a8d4 | 187 | libraries with a few exceptions (such as ``Boost.Python``). Use:: |
494da23a TL |
188 | |
189 | add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) | |
190 | ||
191 | to ask Boost to report information about automatic linking requests. | |
192 | ||
193 | Example to find Boost headers only:: | |
194 | ||
195 | find_package(Boost 1.36.0) | |
196 | if(Boost_FOUND) | |
197 | include_directories(${Boost_INCLUDE_DIRS}) | |
198 | add_executable(foo foo.cc) | |
199 | endif() | |
200 | ||
201 | Example to find Boost libraries and use imported targets:: | |
202 | ||
203 | find_package(Boost 1.56 REQUIRED COMPONENTS | |
204 | date_time filesystem iostreams) | |
205 | add_executable(foo foo.cc) | |
206 | target_link_libraries(foo Boost::date_time Boost::filesystem | |
207 | Boost::iostreams) | |
208 | ||
209 | Example to find Boost Python 3.6 libraries and use imported targets:: | |
210 | ||
211 | find_package(Boost 1.67 REQUIRED COMPONENTS | |
212 | python36 numpy36) | |
213 | add_executable(foo foo.cc) | |
214 | target_link_libraries(foo Boost::python36 Boost::numpy36) | |
215 | ||
216 | Example to find Boost headers and some *static* (release only) libraries:: | |
217 | ||
218 | set(Boost_USE_STATIC_LIBS ON) # only find static libs | |
219 | set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and | |
220 | set(Boost_USE_RELEASE_LIBS ON) # only find release libs | |
221 | set(Boost_USE_MULTITHREADED ON) | |
222 | set(Boost_USE_STATIC_RUNTIME OFF) | |
223 | find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...) | |
224 | if(Boost_FOUND) | |
225 | include_directories(${Boost_INCLUDE_DIRS}) | |
226 | add_executable(foo foo.cc) | |
227 | target_link_libraries(foo ${Boost_LIBRARIES}) | |
228 | endif() | |
229 | ||
230 | Boost CMake | |
231 | ^^^^^^^^^^^ | |
232 | ||
92f5a8d4 TL |
233 | If Boost was built using the boost-cmake project or from Boost 1.70.0 on |
234 | it provides a package configuration file for use with find_package's config mode. | |
235 | This module looks for the package configuration file called | |
236 | ``BoostConfig.cmake`` or ``boost-config.cmake`` and stores the result in | |
237 | ``CACHE`` entry "Boost_DIR". If found, the package configuration file is loaded | |
494da23a TL |
238 | and this module returns with no further action. See documentation of |
239 | the Boost CMake package configuration for details on what it provides. | |
240 | ||
92f5a8d4 | 241 | Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake. |
494da23a | 242 | #]=======================================================================] |
11fdf7f2 | 243 | |
92f5a8d4 TL |
244 | # The FPHSA helper provides standard way of reporting final search results to |
245 | # the user including the version and component checks. | |
246 | include(FindPackageHandleStandardArgs) | |
247 | ||
11fdf7f2 TL |
248 | # Save project's policies |
249 | cmake_policy(PUSH) | |
250 | cmake_policy(SET CMP0057 NEW) # if IN_LIST | |
251 | ||
92f5a8d4 TL |
252 | function(_boost_get_existing_target component target_var) |
253 | set(names "${component}") | |
254 | if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$") | |
255 | # handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc. | |
256 | list(APPEND names | |
257 | "${CMAKE_MATCH_1}${CMAKE_MATCH_2}" # python | |
258 | "${CMAKE_MATCH_1}${CMAKE_MATCH_2}${CMAKE_MATCH_3}" # pythonX | |
259 | "${CMAKE_MATCH_1}${CMAKE_MATCH_2}${CMAKE_MATCH_3}${CMAKE_MATCH_4}" #pythonXY | |
260 | ) | |
261 | endif() | |
262 | # https://github.com/boost-cmake/boost-cmake uses boost::file_system etc. | |
263 | # So handle similar constructions of target names | |
264 | string(TOLOWER "${component}" lower_component) | |
265 | list(APPEND names "${lower_component}") | |
266 | foreach(prefix Boost boost) | |
267 | foreach(name IN LISTS names) | |
268 | if(TARGET "${prefix}::${name}") | |
269 | # The target may be an INTERFACE library that wraps around a single other | |
270 | # target for compatibility. Unwrap this layer so we can extract real info. | |
271 | if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$") | |
272 | set(name_nv "${CMAKE_MATCH_1}") | |
273 | if(TARGET "${prefix}::${name_nv}") | |
274 | get_property(type TARGET "${prefix}::${name}" PROPERTY TYPE) | |
275 | if(type STREQUAL "INTERFACE_LIBRARY") | |
276 | get_property(lib TARGET "${prefix}::${name}" PROPERTY INTERFACE_LINK_LIBRARIES) | |
277 | if("${lib}" STREQUAL "${prefix}::${name_nv}") | |
278 | set(${target_var} "${prefix}::${name_nv}" PARENT_SCOPE) | |
279 | return() | |
280 | endif() | |
281 | endif() | |
282 | endif() | |
283 | endif() | |
284 | set(${target_var} "${prefix}::${name}" PARENT_SCOPE) | |
285 | return() | |
286 | endif() | |
287 | endforeach() | |
288 | endforeach() | |
289 | set(${target_var} "" PARENT_SCOPE) | |
290 | endfunction() | |
291 | ||
292 | function(_boost_get_canonical_target_name component target_var) | |
293 | string(TOLOWER "${component}" component) | |
294 | if(component MATCHES "^([a-z_]*)(python|numpy)([1-9])\\.?([0-9])?$") | |
295 | # handle pythonXY and numpyXY versioned components and also python X.Y, mpi_python etc. | |
296 | set(${target_var} "Boost::${CMAKE_MATCH_1}${CMAKE_MATCH_2}" PARENT_SCOPE) | |
297 | else() | |
298 | set(${target_var} "Boost::${component}" PARENT_SCOPE) | |
299 | endif() | |
300 | endfunction() | |
301 | ||
302 | macro(_boost_set_in_parent_scope name value) | |
303 | # Set a variable in parent scope and make it visibile in current scope | |
304 | set(${name} "${value}" PARENT_SCOPE) | |
305 | set(${name} "${value}") | |
306 | endmacro() | |
307 | ||
308 | macro(_boost_set_if_unset name value) | |
309 | if(NOT ${name}) | |
310 | _boost_set_in_parent_scope(${name} "${value}") | |
311 | endif() | |
312 | endmacro() | |
313 | ||
314 | macro(_boost_set_cache_if_unset name value) | |
315 | if(NOT ${name}) | |
316 | set(${name} "${value}" CACHE STRING "" FORCE) | |
317 | endif() | |
318 | endmacro() | |
319 | ||
320 | macro(_boost_append_include_dir target) | |
321 | get_target_property(inc "${target}" INTERFACE_INCLUDE_DIRECTORIES) | |
322 | if(inc) | |
323 | list(APPEND include_dirs "${inc}") | |
324 | endif() | |
325 | endmacro() | |
326 | ||
327 | function(_boost_set_legacy_variables_from_config) | |
328 | # Set legacy variables for compatibility if not set | |
329 | set(include_dirs "") | |
330 | set(library_dirs "") | |
331 | set(libraries "") | |
332 | # Header targets Boost::headers or Boost::boost | |
333 | foreach(comp headers boost) | |
334 | _boost_get_existing_target(${comp} target) | |
335 | if(target) | |
336 | _boost_append_include_dir("${target}") | |
337 | endif() | |
338 | endforeach() | |
339 | # Library targets | |
340 | foreach(comp IN LISTS Boost_FIND_COMPONENTS) | |
341 | string(TOUPPER ${comp} uppercomp) | |
342 | # Overwrite if set | |
343 | _boost_set_in_parent_scope(Boost_${uppercomp}_FOUND "${Boost_${comp}_FOUND}") | |
344 | if(Boost_${comp}_FOUND) | |
345 | _boost_get_existing_target(${comp} target) | |
346 | if(NOT target) | |
347 | if(Boost_DEBUG OR Boost_VERBOSE) | |
348 | message(WARNING "Could not find imported target for required component '${comp}'. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use.") | |
349 | endif() | |
350 | continue() | |
351 | endif() | |
352 | _boost_append_include_dir("${target}") | |
353 | _boost_set_if_unset(Boost_${uppercomp}_LIBRARY "${target}") | |
354 | _boost_set_if_unset(Boost_${uppercomp}_LIBRARIES "${target}") # Very old legacy variable | |
355 | list(APPEND libraries "${target}") | |
356 | get_property(type TARGET "${target}" PROPERTY TYPE) | |
357 | if(NOT type STREQUAL "INTERFACE_LIBRARY") | |
358 | foreach(cfg RELEASE DEBUG) | |
359 | get_target_property(lib ${target} IMPORTED_LOCATION_${cfg}) | |
360 | if(lib) | |
361 | get_filename_component(lib_dir "${lib}" DIRECTORY) | |
362 | list(APPEND library_dirs ${lib_dir}) | |
363 | _boost_set_cache_if_unset(Boost_${uppercomp}_LIBRARY_${cfg} "${lib}") | |
364 | endif() | |
365 | endforeach() | |
366 | elseif(Boost_DEBUG OR Boost_VERBOSE) | |
367 | # For projects using only the Boost::* targets this warning can be safely ignored. | |
368 | message(WARNING "Imported target '${target}' for required component '${comp}' has no artifact. Legacy variables for this component might be missing. Refer to the documentation of your Boost installation for help on variables to use.") | |
369 | endif() | |
370 | _boost_get_canonical_target_name("${comp}" canonical_target) | |
371 | if(NOT TARGET "${canonical_target}") | |
372 | add_library("${canonical_target}" INTERFACE IMPORTED) | |
373 | target_link_libraries("${canonical_target}" INTERFACE "${target}") | |
374 | endif() | |
375 | endif() | |
376 | endforeach() | |
377 | list(REMOVE_DUPLICATES include_dirs) | |
378 | list(REMOVE_DUPLICATES library_dirs) | |
379 | _boost_set_if_unset(Boost_INCLUDE_DIRS "${include_dirs}") | |
380 | _boost_set_if_unset(Boost_LIBRARY_DIRS "${library_dirs}") | |
381 | _boost_set_if_unset(Boost_LIBRARIES "${libraries}") | |
382 | _boost_set_if_unset(Boost_VERSION_STRING "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}") | |
383 | find_path(Boost_INCLUDE_DIR | |
384 | NAMES boost/version.hpp boost/config.hpp | |
385 | HINTS ${Boost_INCLUDE_DIRS} | |
386 | NO_DEFAULT_PATH | |
387 | ) | |
388 | if(NOT Boost_VERSION_MACRO OR NOT Boost_LIB_VERSION) | |
389 | set(version_file ${Boost_INCLUDE_DIR}/boost/version.hpp) | |
390 | if(EXISTS "${version_file}") | |
391 | file(STRINGS "${version_file}" contents REGEX "#define BOOST_(LIB_)?VERSION ") | |
392 | if(contents MATCHES "#define BOOST_VERSION ([0-9]+)") | |
393 | _boost_set_if_unset(Boost_VERSION_MACRO "${CMAKE_MATCH_1}") | |
394 | endif() | |
395 | if(contents MATCHES "#define BOOST_LIB_VERSION \"([0-9_]+)\"") | |
396 | _boost_set_if_unset(Boost_LIB_VERSION "${CMAKE_MATCH_1}") | |
397 | endif() | |
398 | endif() | |
399 | endif() | |
400 | _boost_set_if_unset(Boost_MAJOR_VERSION ${Boost_VERSION_MAJOR}) | |
401 | _boost_set_if_unset(Boost_MINOR_VERSION ${Boost_VERSION_MINOR}) | |
402 | _boost_set_if_unset(Boost_SUBMINOR_VERSION ${Boost_VERSION_PATCH}) | |
403 | if(WIN32) | |
404 | _boost_set_if_unset(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") | |
405 | endif() | |
406 | if(NOT TARGET Boost::headers) | |
407 | add_library(Boost::headers INTERFACE IMPORTED) | |
408 | target_include_directories(Boost::headers INTERFACE ${Boost_INCLUDE_DIRS}) | |
409 | endif() | |
410 | # Legacy targets w/o functionality as all handled by defined targets | |
411 | foreach(lib diagnostic_definitions disable_autolinking dynamic_linking) | |
412 | if(NOT TARGET Boost::${lib}) | |
413 | add_library(Boost::${lib} INTERFACE IMPORTED) | |
414 | endif() | |
415 | endforeach() | |
416 | if(NOT TARGET Boost::boost) | |
417 | add_library(Boost::boost INTERFACE IMPORTED) | |
418 | target_link_libraries(Boost::boost INTERFACE Boost::headers) | |
419 | endif() | |
420 | endfunction() | |
494da23a | 421 | |
11fdf7f2 | 422 | #------------------------------------------------------------------------------- |
92f5a8d4 TL |
423 | # Before we go searching, check whether a boost cmake package is available, unless |
424 | # the user specifically asked NOT to search for one. | |
11fdf7f2 TL |
425 | # |
426 | # If Boost_DIR is set, this behaves as any find_package call would. If not, | |
427 | # it looks at BOOST_ROOT and BOOSTROOT to find Boost. | |
428 | # | |
429 | if (NOT Boost_NO_BOOST_CMAKE) | |
430 | # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives, | |
431 | # since these are more conventional for Boost. | |
432 | if ("$ENV{Boost_DIR}" STREQUAL "") | |
433 | if (NOT "$ENV{BOOST_ROOT}" STREQUAL "") | |
434 | set(ENV{Boost_DIR} $ENV{BOOST_ROOT}) | |
435 | elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "") | |
436 | set(ENV{Boost_DIR} $ENV{BOOSTROOT}) | |
437 | endif() | |
438 | endif() | |
439 | ||
440 | # Do the same find_package call but look specifically for the CMake version. | |
441 | # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no | |
442 | # need to delegate them to this find_package call. | |
443 | find_package(Boost QUIET NO_MODULE) | |
444 | mark_as_advanced(Boost_DIR) | |
445 | ||
92f5a8d4 | 446 | # If we found a boost cmake package, then we're done. Print out what we found. |
11fdf7f2 | 447 | # Otherwise let the rest of the module try to find it. |
92f5a8d4 TL |
448 | if(Boost_FOUND) |
449 | # Convert component found variables to standard variables if required | |
450 | # Necessary for legacy boost-cmake and 1.70 builtin BoostConfig | |
451 | if(Boost_FIND_COMPONENTS) | |
452 | # Ignore the meta-component "ALL", introduced by Boost 1.73 | |
453 | list(REMOVE_ITEM Boost_FIND_COMPONENTS "ALL") | |
454 | ||
455 | foreach(_comp IN LISTS Boost_FIND_COMPONENTS) | |
456 | if(DEFINED Boost_${_comp}_FOUND) | |
457 | continue() | |
458 | endif() | |
459 | string(TOUPPER ${_comp} _uppercomp) | |
460 | if(DEFINED Boost${_comp}_FOUND) # legacy boost-cmake project | |
461 | set(Boost_${_comp}_FOUND ${Boost${_comp}_FOUND}) | |
462 | elseif(DEFINED Boost_${_uppercomp}_FOUND) # Boost 1.70 | |
463 | set(Boost_${_comp}_FOUND ${Boost_${_uppercomp}_FOUND}) | |
464 | endif() | |
465 | endforeach() | |
11fdf7f2 | 466 | endif() |
92f5a8d4 TL |
467 | |
468 | find_package_handle_standard_args(Boost HANDLE_COMPONENTS CONFIG_MODE) | |
469 | _boost_set_legacy_variables_from_config() | |
470 | ||
11fdf7f2 TL |
471 | # Restore project's policies |
472 | cmake_policy(POP) | |
473 | return() | |
474 | endif() | |
475 | endif() | |
476 | ||
477 | ||
478 | #------------------------------------------------------------------------------- | |
479 | # FindBoost functions & macros | |
480 | # | |
481 | ||
92f5a8d4 TL |
482 | # |
483 | # Print debug text if Boost_DEBUG is set. | |
484 | # Call example: | |
485 | # _Boost_DEBUG_PRINT("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "debug message") | |
486 | # | |
487 | function(_Boost_DEBUG_PRINT file line text) | |
488 | if(Boost_DEBUG) | |
489 | message(STATUS "[ ${file}:${line} ] ${text}") | |
490 | endif() | |
491 | endfunction() | |
492 | ||
493 | # | |
494 | # _Boost_DEBUG_PRINT_VAR(file line variable_name [ENVIRONMENT] | |
495 | # [SOURCE "short explanation of origin of var value"]) | |
496 | # | |
497 | # ENVIRONMENT - look up environment variable instead of CMake variable | |
498 | # | |
499 | # Print variable name and its value if Boost_DEBUG is set. | |
500 | # Call example: | |
501 | # _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" BOOST_ROOT) | |
502 | # | |
503 | function(_Boost_DEBUG_PRINT_VAR file line name) | |
504 | if(Boost_DEBUG) | |
505 | cmake_parse_arguments(_args "ENVIRONMENT" "SOURCE" "" ${ARGN}) | |
506 | ||
507 | unset(source) | |
508 | if(_args_SOURCE) | |
509 | set(source " (${_args_SOURCE})") | |
510 | endif() | |
511 | ||
512 | if(_args_ENVIRONMENT) | |
513 | if(DEFINED ENV{${name}}) | |
514 | set(value "\"$ENV{${name}}\"") | |
515 | else() | |
516 | set(value "<unset>") | |
517 | endif() | |
518 | set(_name "ENV{${name}}") | |
519 | else() | |
520 | if(DEFINED "${name}") | |
521 | set(value "\"${${name}}\"") | |
522 | else() | |
523 | set(value "<unset>") | |
524 | endif() | |
525 | set(_name "${name}") | |
526 | endif() | |
527 | ||
528 | _Boost_DEBUG_PRINT("${file}" "${line}" "${_name} = ${value}${source}") | |
529 | endif() | |
530 | endfunction() | |
531 | ||
11fdf7f2 TL |
532 | ############################################ |
533 | # | |
534 | # Check the existence of the libraries. | |
535 | # | |
536 | ############################################ | |
537 | # This macro was taken directly from the FindQt4.cmake file that is included | |
538 | # with the CMake distribution. This is NOT my work. All work was done by the | |
539 | # original authors of the FindQt4.cmake file. Only minor modifications were | |
540 | # made to remove references to Qt and make this file more generally applicable | |
541 | # And ELSE/ENDIF pairs were removed for readability. | |
542 | ######################################################################### | |
543 | ||
544 | macro(_Boost_ADJUST_LIB_VARS basename) | |
545 | if(Boost_INCLUDE_DIR ) | |
546 | if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) | |
547 | # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for | |
548 | # single-config generators, set optimized and debug libraries | |
549 | get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | |
550 | if(_isMultiConfig OR CMAKE_BUILD_TYPE) | |
551 | set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) | |
552 | else() | |
553 | # For single-config generators where CMAKE_BUILD_TYPE has no value, | |
554 | # just use the release libraries | |
555 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) | |
556 | endif() | |
557 | # FIXME: This probably should be set for both cases | |
558 | set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) | |
559 | endif() | |
560 | ||
561 | # if only the release version was found, set the debug variable also to the release version | |
562 | if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) | |
563 | set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) | |
564 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) | |
565 | set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) | |
566 | endif() | |
567 | ||
568 | # if only the debug version was found, set the release variable also to the debug version | |
569 | if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) | |
570 | set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) | |
571 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) | |
572 | set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) | |
573 | endif() | |
574 | ||
575 | # If the debug & release library ends up being the same, omit the keywords | |
576 | if("${Boost_${basename}_LIBRARY_RELEASE}" STREQUAL "${Boost_${basename}_LIBRARY_DEBUG}") | |
577 | set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) | |
578 | set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} ) | |
579 | endif() | |
580 | ||
581 | if(Boost_${basename}_LIBRARY AND Boost_${basename}_HEADER) | |
582 | set(Boost_${basename}_FOUND ON) | |
583 | if("x${basename}" STREQUAL "xTHREAD" AND NOT TARGET Threads::Threads) | |
584 | string(APPEND Boost_ERROR_REASON_THREAD " (missing dependency: Threads)") | |
585 | set(Boost_THREAD_FOUND OFF) | |
586 | endif() | |
587 | endif() | |
588 | ||
589 | endif() | |
590 | # Make variables changeable to the advanced user | |
591 | mark_as_advanced( | |
592 | Boost_${basename}_LIBRARY_RELEASE | |
593 | Boost_${basename}_LIBRARY_DEBUG | |
594 | ) | |
595 | endmacro() | |
596 | ||
597 | # Detect changes in used variables. | |
598 | # Compares the current variable value with the last one. | |
599 | # In short form: | |
600 | # v != v_LAST -> CHANGED = 1 | |
601 | # v is defined, v_LAST not -> CHANGED = 1 | |
602 | # v is not defined, but v_LAST is -> CHANGED = 1 | |
603 | # otherwise -> CHANGED = 0 | |
604 | # CHANGED is returned in variable named ${changed_var} | |
605 | macro(_Boost_CHANGE_DETECT changed_var) | |
606 | set(${changed_var} 0) | |
607 | foreach(v ${ARGN}) | |
608 | if(DEFINED _Boost_COMPONENTS_SEARCHED) | |
609 | if(${v}) | |
610 | if(_${v}_LAST) | |
611 | string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED) | |
612 | else() | |
613 | set(_${v}_CHANGED 1) | |
614 | endif() | |
615 | elseif(_${v}_LAST) | |
616 | set(_${v}_CHANGED 1) | |
617 | endif() | |
618 | if(_${v}_CHANGED) | |
619 | set(${changed_var} 1) | |
620 | endif() | |
621 | else() | |
622 | set(_${v}_CHANGED 0) | |
623 | endif() | |
624 | endforeach() | |
625 | endmacro() | |
626 | ||
627 | # | |
628 | # Find the given library (var). | |
629 | # Use 'build_type' to support different lib paths for RELEASE or DEBUG builds | |
630 | # | |
631 | macro(_Boost_FIND_LIBRARY var build_type) | |
632 | ||
633 | find_library(${var} ${ARGN}) | |
634 | ||
635 | if(${var}) | |
636 | # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. | |
637 | if(NOT Boost_LIBRARY_DIR_${build_type}) | |
638 | get_filename_component(_dir "${${var}}" PATH) | |
639 | set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE) | |
640 | endif() | |
641 | elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) | |
642 | # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. | |
643 | find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) | |
644 | endif() | |
645 | ||
646 | # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there. | |
647 | if(Boost_LIBRARY_DIR_${build_type}) | |
648 | set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) | |
92f5a8d4 TL |
649 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
650 | "Boost_LIBRARY_DIR_${build_type}") | |
651 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" | |
652 | "_boost_LIBRARY_SEARCH_DIRS_${build_type}") | |
11fdf7f2 TL |
653 | endif() |
654 | endmacro() | |
655 | ||
656 | #------------------------------------------------------------------------------- | |
657 | ||
658 | # Convert CMAKE_CXX_COMPILER_VERSION to boost compiler suffix version. | |
659 | function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION _OUTPUT_VERSION_MAJOR _OUTPUT_VERSION_MINOR) | |
660 | string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1" | |
661 | _boost_COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}") | |
662 | string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\2" | |
663 | _boost_COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") | |
664 | ||
665 | set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}${_boost_COMPILER_VERSION_MINOR}") | |
666 | ||
667 | set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) | |
668 | set(${_OUTPUT_VERSION_MAJOR} ${_boost_COMPILER_VERSION_MAJOR} PARENT_SCOPE) | |
669 | set(${_OUTPUT_VERSION_MINOR} ${_boost_COMPILER_VERSION_MINOR} PARENT_SCOPE) | |
670 | endfunction() | |
671 | ||
672 | # | |
673 | # Take a list of libraries with "thread" in it | |
674 | # and prepend duplicates with "thread_${Boost_THREADAPI}" | |
675 | # at the front of the list | |
676 | # | |
677 | function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) | |
678 | set(_orig_libnames ${ARGN}) | |
679 | string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}") | |
680 | set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) | |
681 | endfunction() | |
682 | ||
683 | # | |
684 | # If a library is found, replace its cache entry with its REALPATH | |
685 | # | |
686 | function(_Boost_SWAP_WITH_REALPATH _library _docstring) | |
687 | if(${_library}) | |
688 | get_filename_component(_boost_filepathreal ${${_library}} REALPATH) | |
689 | unset(${_library} CACHE) | |
690 | set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") | |
691 | endif() | |
692 | endfunction() | |
693 | ||
694 | function(_Boost_CHECK_SPELLING _var) | |
695 | if(${_var}) | |
696 | string(TOUPPER ${_var} _var_UC) | |
697 | message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.") | |
698 | endif() | |
699 | endfunction() | |
700 | ||
701 | # Guesses Boost's compiler prefix used in built library names | |
702 | # Returns the guess by setting the variable pointed to by _ret | |
703 | function(_Boost_GUESS_COMPILER_PREFIX _ret) | |
704 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") | |
705 | if(WIN32) | |
706 | set (_boost_COMPILER "-iw") | |
707 | else() | |
708 | set (_boost_COMPILER "-il") | |
709 | endif() | |
710 | elseif (GHSMULTI) | |
711 | set(_boost_COMPILER "-ghs") | |
92f5a8d4 | 712 | elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") |
494da23a TL |
713 | if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150) |
714 | # Not yet known. | |
715 | set(_boost_COMPILER "") | |
716 | elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 140) | |
717 | # MSVC toolset 14.x versions are forward compatible. | |
718 | set(_boost_COMPILER "") | |
719 | foreach(v 9 8 7 6 5 4 3 2 1 0) | |
720 | if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v}) | |
721 | list(APPEND _boost_COMPILER "-vc14${v}") | |
722 | endif() | |
723 | endforeach() | |
11fdf7f2 TL |
724 | elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80) |
725 | set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}") | |
726 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10) | |
727 | set(_boost_COMPILER "-vc71") | |
728 | elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck! | |
729 | set(_boost_COMPILER "-vc7") # yes, this is correct | |
730 | else() # VS 6.0 Good luck! | |
731 | set(_boost_COMPILER "-vc6") # yes, this is correct | |
732 | endif() | |
92f5a8d4 TL |
733 | |
734 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang") | |
735 | string(REPLACE "." ";" VERSION_LIST "${CMAKE_CXX_COMPILER_VERSION}") | |
736 | list(GET VERSION_LIST 0 CLANG_VERSION_MAJOR) | |
737 | set(_boost_COMPILER "-clangw${CLANG_VERSION_MAJOR};${_boost_COMPILER}") | |
738 | endif() | |
11fdf7f2 TL |
739 | elseif (BORLAND) |
740 | set(_boost_COMPILER "-bcb") | |
741 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") | |
742 | set(_boost_COMPILER "-sw") | |
743 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL") | |
744 | set(_boost_COMPILER "-xlc") | |
745 | elseif (MINGW) | |
92f5a8d4 | 746 | if(Boost_VERSION_STRING VERSION_LESS 1.34) |
11fdf7f2 TL |
747 | set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 |
748 | else() | |
749 | _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR) | |
750 | set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") | |
751 | endif() | |
752 | elseif (UNIX) | |
753 | _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR) | |
92f5a8d4 | 754 | if(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0) |
11fdf7f2 TL |
755 | # From GCC 5 and clang 4, versioning changes and minor becomes patch. |
756 | # For those compilers, patch is exclude from compiler tag in Boost 1.69+ library naming. | |
757 | if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4) | |
758 | set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}") | |
759 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3) | |
760 | set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}") | |
761 | endif() | |
762 | endif() | |
763 | ||
764 | if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | |
92f5a8d4 | 765 | if(Boost_VERSION_STRING VERSION_LESS 1.34) |
11fdf7f2 TL |
766 | set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 |
767 | else() | |
768 | # Determine which version of GCC we have. | |
769 | if(APPLE) | |
92f5a8d4 TL |
770 | if(Boost_VERSION_STRING VERSION_LESS 1.36.0) |
771 | # In Boost <= 1.35.0, there is no mangled compiler name for | |
772 | # the macOS/Darwin version of GCC. | |
11fdf7f2 | 773 | set(_boost_COMPILER "") |
92f5a8d4 TL |
774 | else() |
775 | # In Boost 1.36.0 and newer, the mangled compiler name used | |
776 | # on macOS/Darwin is "xgcc". | |
777 | set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") | |
11fdf7f2 TL |
778 | endif() |
779 | else() | |
780 | set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") | |
781 | endif() | |
782 | endif() | |
783 | elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | |
784 | # TODO: Find out any Boost version constraints vs clang support. | |
785 | set(_boost_COMPILER "-clang${_boost_COMPILER_VERSION}") | |
786 | endif() | |
787 | else() | |
11fdf7f2 TL |
788 | set(_boost_COMPILER "") |
789 | endif() | |
92f5a8d4 TL |
790 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
791 | "_boost_COMPILER" SOURCE "guessed") | |
11fdf7f2 TL |
792 | set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) |
793 | endfunction() | |
794 | ||
795 | # | |
796 | # Get component dependencies. Requires the dependencies to have been | |
797 | # defined for the Boost release version. | |
798 | # | |
799 | # component - the component to check | |
800 | # _ret - list of library dependencies | |
801 | # | |
802 | function(_Boost_COMPONENT_DEPENDENCIES component _ret) | |
803 | # Note: to add a new Boost release, run | |
804 | # | |
805 | # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake | |
806 | # | |
807 | # The output may be added in a new block below. If it's the same as | |
808 | # the previous release, simply update the version range of the block | |
809 | # for the previous release. Also check if any new components have | |
810 | # been added, and add any new components to | |
811 | # _Boost_COMPONENT_HEADERS. | |
812 | # | |
813 | # This information was originally generated by running | |
814 | # BoostScanDeps.cmake against every boost release to date supported | |
815 | # by FindBoost: | |
816 | # | |
817 | # % for version in /path/to/boost/sources/* | |
818 | # do | |
819 | # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake | |
820 | # done | |
821 | # | |
822 | # The output was then updated by search and replace with these regexes: | |
823 | # | |
824 | # - Strip message(STATUS) prefix dashes | |
825 | # s;^-- ;; | |
826 | # - Indent | |
827 | # s;^set(; set(;; | |
828 | # - Add conditionals | |
92f5a8d4 | 829 | # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION_STRING VERSION_LESS \1\.\2\.\3 AND Boost_VERSION_STRING VERSION_LESS xxxx); |
11fdf7f2 TL |
830 | # |
831 | # This results in the logic seen below, but will require the xxxx | |
832 | # replacing with the following Boost release version (or the next | |
833 | # minor version to be released, e.g. 1.59 was the latest at the time | |
92f5a8d4 TL |
834 | # of writing, making 1.60 the next. Identical consecutive releases |
835 | # were then merged together by updating the end range of the first | |
836 | # block and removing the following redundant blocks. | |
11fdf7f2 TL |
837 | # |
838 | # Running the script against all historical releases should be | |
839 | # required only if the BoostScanDeps.cmake script logic is changed. | |
840 | # The addition of a new release should only require it to be run | |
841 | # against the new release. | |
842 | ||
843 | # Handle Python version suffixes | |
844 | if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$") | |
845 | set(component "${CMAKE_MATCH_1}") | |
846 | set(component_python_version "${CMAKE_MATCH_2}") | |
847 | endif() | |
848 | ||
849 | set(_Boost_IMPORTED_TARGETS TRUE) | |
92f5a8d4 TL |
850 | if(Boost_VERSION_STRING AND Boost_VERSION_STRING VERSION_LESS 1.33.0) |
851 | message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION_STRING} (all versions older than 1.33)") | |
11fdf7f2 | 852 | set(_Boost_IMPORTED_TARGETS FALSE) |
92f5a8d4 | 853 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.33.0 AND Boost_VERSION_STRING VERSION_LESS 1.35.0) |
11fdf7f2 TL |
854 | set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) |
855 | set(_Boost_REGEX_DEPENDENCIES thread) | |
856 | set(_Boost_WAVE_DEPENDENCIES filesystem thread) | |
857 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 858 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.35.0 AND Boost_VERSION_STRING VERSION_LESS 1.36.0) |
11fdf7f2 TL |
859 | set(_Boost_FILESYSTEM_DEPENDENCIES system) |
860 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
861 | set(_Boost_MPI_DEPENDENCIES serialization) | |
862 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
863 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread) | |
864 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 865 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.36.0 AND Boost_VERSION_STRING VERSION_LESS 1.38.0) |
11fdf7f2 TL |
866 | set(_Boost_FILESYSTEM_DEPENDENCIES system) |
867 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
868 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) | |
869 | set(_Boost_MPI_DEPENDENCIES serialization) | |
870 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
871 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread) | |
872 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 873 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.38.0 AND Boost_VERSION_STRING VERSION_LESS 1.43.0) |
11fdf7f2 TL |
874 | set(_Boost_FILESYSTEM_DEPENDENCIES system) |
875 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
876 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) | |
877 | set(_Boost_MPI_DEPENDENCIES serialization) | |
878 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
879 | set(_Boost_THREAD_DEPENDENCIES date_time) | |
880 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) | |
881 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 882 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.43.0 AND Boost_VERSION_STRING VERSION_LESS 1.44.0) |
11fdf7f2 TL |
883 | set(_Boost_FILESYSTEM_DEPENDENCIES system) |
884 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
885 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) | |
886 | set(_Boost_MPI_DEPENDENCIES serialization) | |
887 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
888 | set(_Boost_THREAD_DEPENDENCIES date_time) | |
889 | set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) | |
890 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 891 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.44.0 AND Boost_VERSION_STRING VERSION_LESS 1.45.0) |
11fdf7f2 TL |
892 | set(_Boost_FILESYSTEM_DEPENDENCIES system) |
893 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
894 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) | |
895 | set(_Boost_MPI_DEPENDENCIES serialization) | |
896 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
897 | set(_Boost_THREAD_DEPENDENCIES date_time) | |
898 | set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) | |
899 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 900 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.45.0 AND Boost_VERSION_STRING VERSION_LESS 1.47.0) |
11fdf7f2 TL |
901 | set(_Boost_FILESYSTEM_DEPENDENCIES system) |
902 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
903 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) | |
904 | set(_Boost_MPI_DEPENDENCIES serialization) | |
905 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
906 | set(_Boost_THREAD_DEPENDENCIES date_time) | |
907 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) | |
908 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 909 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.47.0 AND Boost_VERSION_STRING VERSION_LESS 1.48.0) |
11fdf7f2 TL |
910 | set(_Boost_CHRONO_DEPENDENCIES system) |
911 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
912 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
913 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) | |
914 | set(_Boost_MPI_DEPENDENCIES serialization) | |
915 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
916 | set(_Boost_THREAD_DEPENDENCIES date_time) | |
917 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) | |
918 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 919 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.48.0 AND Boost_VERSION_STRING VERSION_LESS 1.50.0) |
11fdf7f2 TL |
920 | set(_Boost_CHRONO_DEPENDENCIES system) |
921 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
922 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
923 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) | |
924 | set(_Boost_MPI_DEPENDENCIES serialization) | |
925 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
926 | set(_Boost_THREAD_DEPENDENCIES date_time) | |
927 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
928 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) | |
929 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 930 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.50.0 AND Boost_VERSION_STRING VERSION_LESS 1.53.0) |
11fdf7f2 TL |
931 | set(_Boost_CHRONO_DEPENDENCIES system) |
932 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
933 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
934 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) | |
935 | set(_Boost_MPI_DEPENDENCIES serialization) | |
936 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
937 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time) | |
938 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
939 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) | |
940 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 941 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.53.0 AND Boost_VERSION_STRING VERSION_LESS 1.54.0) |
11fdf7f2 TL |
942 | set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) |
943 | set(_Boost_CHRONO_DEPENDENCIES system) | |
944 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
945 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
946 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) | |
947 | set(_Boost_MPI_DEPENDENCIES serialization) | |
948 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
949 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
950 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
951 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) | |
952 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 953 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.54.0 AND Boost_VERSION_STRING VERSION_LESS 1.55.0) |
11fdf7f2 TL |
954 | set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) |
955 | set(_Boost_CHRONO_DEPENDENCIES system) | |
956 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
957 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
958 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) | |
959 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) | |
960 | set(_Boost_MPI_DEPENDENCIES serialization) | |
961 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
962 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
963 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
964 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
965 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 966 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.55.0 AND Boost_VERSION_STRING VERSION_LESS 1.56.0) |
11fdf7f2 TL |
967 | set(_Boost_CHRONO_DEPENDENCIES system) |
968 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
969 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
970 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
971 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) | |
972 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) | |
973 | set(_Boost_MPI_DEPENDENCIES serialization) | |
974 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
975 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
976 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
977 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
978 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 979 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.56.0 AND Boost_VERSION_STRING VERSION_LESS 1.59.0) |
11fdf7f2 TL |
980 | set(_Boost_CHRONO_DEPENDENCIES system) |
981 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
982 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
983 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
984 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) | |
985 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
986 | set(_Boost_MPI_DEPENDENCIES serialization) | |
987 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
988 | set(_Boost_RANDOM_DEPENDENCIES system) | |
989 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
990 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
991 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
992 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 993 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.59.0 AND Boost_VERSION_STRING VERSION_LESS 1.60.0) |
11fdf7f2 TL |
994 | set(_Boost_CHRONO_DEPENDENCIES system) |
995 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
996 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
997 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
998 | set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) | |
999 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1000 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1001 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1002 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1003 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1004 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
1005 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1006 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1007 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.60.0 AND Boost_VERSION_STRING VERSION_LESS 1.61.0) |
11fdf7f2 TL |
1008 | set(_Boost_CHRONO_DEPENDENCIES system) |
1009 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1010 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1011 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1012 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1013 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1014 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1015 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1016 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1017 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1018 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
1019 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1020 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1021 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.61.0 AND Boost_VERSION_STRING VERSION_LESS 1.62.0) |
11fdf7f2 TL |
1022 | set(_Boost_CHRONO_DEPENDENCIES system) |
1023 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) | |
1024 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1025 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1026 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1027 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1028 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1029 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1030 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1031 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1032 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1033 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1034 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1035 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.62.0 AND Boost_VERSION_STRING VERSION_LESS 1.63.0) |
11fdf7f2 TL |
1036 | set(_Boost_CHRONO_DEPENDENCIES system) |
1037 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) | |
1038 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1039 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) | |
1040 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1041 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1042 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1043 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1044 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1045 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1046 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1047 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1048 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1049 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1050 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.63.0 AND Boost_VERSION_STRING VERSION_LESS 1.65.0) |
11fdf7f2 TL |
1051 | set(_Boost_CHRONO_DEPENDENCIES system) |
1052 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) | |
1053 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1054 | set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time) | |
1055 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) | |
1056 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1057 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1058 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1059 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1060 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1061 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1062 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1063 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1064 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1065 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1066 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.65.0 AND Boost_VERSION_STRING VERSION_LESS 1.67.0) |
11fdf7f2 TL |
1067 | set(_Boost_CHRONO_DEPENDENCIES system) |
1068 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) | |
1069 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1070 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) | |
1071 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1072 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1073 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1074 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1075 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1076 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1077 | set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) | |
1078 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1079 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1080 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
1081 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1082 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1083 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.67.0 AND Boost_VERSION_STRING VERSION_LESS 1.68.0) |
11fdf7f2 TL |
1084 | set(_Boost_CHRONO_DEPENDENCIES system) |
1085 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) | |
1086 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1087 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) | |
1088 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1089 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1090 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1091 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1092 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1093 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1094 | set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) | |
1095 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1096 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1097 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
1098 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1099 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1100 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.68.0 AND Boost_VERSION_STRING VERSION_LESS 1.69.0) |
11fdf7f2 TL |
1101 | set(_Boost_CHRONO_DEPENDENCIES system) |
1102 | set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) | |
1103 | set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time) | |
1104 | set(_Boost_COROUTINE_DEPENDENCIES context system) | |
1105 | set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) | |
1106 | set(_Boost_FILESYSTEM_DEPENDENCIES system) | |
1107 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1108 | set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) | |
1109 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1110 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1111 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1112 | set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) | |
1113 | set(_Boost_RANDOM_DEPENDENCIES system) | |
1114 | set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) | |
1115 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
1116 | set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) | |
1117 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 | 1118 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.69.0 AND Boost_VERSION_STRING VERSION_LESS 1.70.0) |
494da23a TL |
1119 | set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) |
1120 | set(_Boost_COROUTINE_DEPENDENCIES context) | |
1121 | set(_Boost_FIBER_DEPENDENCIES context) | |
1122 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1123 | set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) | |
1124 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1125 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1126 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1127 | set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) | |
1128 | set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) | |
1129 | set(_Boost_TIMER_DEPENDENCIES chrono system) | |
1130 | set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) | |
1131 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
92f5a8d4 TL |
1132 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.70.0 AND Boost_VERSION_STRING VERSION_LESS 1.72.0) |
1133 | set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) | |
1134 | set(_Boost_COROUTINE_DEPENDENCIES context) | |
1135 | set(_Boost_FIBER_DEPENDENCIES context) | |
1136 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1137 | set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) | |
1138 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) | |
1139 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1140 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1141 | set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) | |
1142 | set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) | |
1143 | set(_Boost_TIMER_DEPENDENCIES chrono) | |
1144 | set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) | |
1145 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
1146 | elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.72.0) | |
1147 | set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) | |
1148 | set(_Boost_COROUTINE_DEPENDENCIES context) | |
1149 | set(_Boost_FIBER_DEPENDENCIES context) | |
1150 | set(_Boost_IOSTREAMS_DEPENDENCIES regex) | |
1151 | set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) | |
1152 | set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l chrono atomic) | |
1153 | set(_Boost_MPI_DEPENDENCIES serialization) | |
1154 | set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) | |
1155 | set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) | |
1156 | set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) | |
1157 | set(_Boost_TIMER_DEPENDENCIES chrono) | |
1158 | set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) | |
1159 | set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) | |
1160 | if(NOT Boost_VERSION_STRING VERSION_LESS 1.73.0) | |
11fdf7f2 TL |
1161 | message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") |
1162 | endif() | |
1163 | endif() | |
1164 | ||
1165 | string(TOUPPER ${component} uppercomponent) | |
1166 | set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) | |
1167 | set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) | |
1168 | ||
1169 | string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") | |
1170 | if (NOT _boost_DEPS_STRING) | |
1171 | set(_boost_DEPS_STRING "(none)") | |
1172 | endif() | |
1173 | # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") | |
1174 | endfunction() | |
1175 | ||
1176 | # | |
1177 | # Get component headers. This is the primary header (or headers) for | |
1178 | # a given component, and is used to check that the headers are present | |
1179 | # as well as the library itself as an extra sanity check of the build | |
1180 | # environment. | |
1181 | # | |
1182 | # component - the component to check | |
1183 | # _hdrs | |
1184 | # | |
1185 | function(_Boost_COMPONENT_HEADERS component _hdrs) | |
1186 | # Handle Python version suffixes | |
1187 | if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$") | |
1188 | set(component "${CMAKE_MATCH_1}") | |
1189 | set(component_python_version "${CMAKE_MATCH_2}") | |
1190 | endif() | |
1191 | ||
1192 | # Note: new boost components will require adding here. The header | |
1193 | # must be present in all versions of Boost providing a library. | |
1194 | set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp") | |
1195 | set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") | |
1196 | set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") | |
1197 | set(_Boost_CONTRACT_HEADERS "boost/contract.hpp") | |
92f5a8d4 | 1198 | if(Boost_VERSION_STRING VERSION_LESS 1.61.0) |
11fdf7f2 TL |
1199 | set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") |
1200 | else() | |
1201 | set(_Boost_CONTEXT_HEADERS "boost/context/detail/fcontext.hpp") | |
1202 | endif() | |
1203 | set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") | |
1204 | set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") | |
1205 | set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") | |
1206 | set(_Boost_FIBER_HEADERS "boost/fiber/all.hpp") | |
1207 | set(_Boost_FILESYSTEM_HEADERS "boost/filesystem/path.hpp") | |
1208 | set(_Boost_GRAPH_HEADERS "boost/graph/adjacency_list.hpp") | |
1209 | set(_Boost_GRAPH_PARALLEL_HEADERS "boost/graph/adjacency_list.hpp") | |
1210 | set(_Boost_IOSTREAMS_HEADERS "boost/iostreams/stream.hpp") | |
1211 | set(_Boost_LOCALE_HEADERS "boost/locale.hpp") | |
1212 | set(_Boost_LOG_HEADERS "boost/log/core.hpp") | |
1213 | set(_Boost_LOG_SETUP_HEADERS "boost/log/detail/setup_config.hpp") | |
1214 | set(_Boost_MATH_HEADERS "boost/math_fwd.hpp") | |
1215 | set(_Boost_MATH_C99_HEADERS "boost/math/tr1.hpp") | |
1216 | set(_Boost_MATH_C99F_HEADERS "boost/math/tr1.hpp") | |
1217 | set(_Boost_MATH_C99L_HEADERS "boost/math/tr1.hpp") | |
1218 | set(_Boost_MATH_TR1_HEADERS "boost/math/tr1.hpp") | |
1219 | set(_Boost_MATH_TR1F_HEADERS "boost/math/tr1.hpp") | |
1220 | set(_Boost_MATH_TR1L_HEADERS "boost/math/tr1.hpp") | |
1221 | set(_Boost_MPI_HEADERS "boost/mpi.hpp") | |
1222 | set(_Boost_MPI_PYTHON_HEADERS "boost/mpi/python/config.hpp") | |
1223 | set(_Boost_NUMPY_HEADERS "boost/python/numpy.hpp") | |
1224 | set(_Boost_PRG_EXEC_MONITOR_HEADERS "boost/test/prg_exec_monitor.hpp") | |
1225 | set(_Boost_PROGRAM_OPTIONS_HEADERS "boost/program_options.hpp") | |
1226 | set(_Boost_PYTHON_HEADERS "boost/python.hpp") | |
1227 | set(_Boost_RANDOM_HEADERS "boost/random.hpp") | |
1228 | set(_Boost_REGEX_HEADERS "boost/regex.hpp") | |
1229 | set(_Boost_SERIALIZATION_HEADERS "boost/serialization/serialization.hpp") | |
1230 | set(_Boost_SIGNALS_HEADERS "boost/signals.hpp") | |
1231 | set(_Boost_STACKTRACE_ADDR2LINE_HEADERS "boost/stacktrace.hpp") | |
1232 | set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp") | |
1233 | set(_Boost_STACKTRACE_BASIC_HEADERS "boost/stacktrace.hpp") | |
1234 | set(_Boost_STACKTRACE_NOOP_HEADERS "boost/stacktrace.hpp") | |
1235 | set(_Boost_STACKTRACE_WINDBG_CACHED_HEADERS "boost/stacktrace.hpp") | |
1236 | set(_Boost_STACKTRACE_WINDBG_HEADERS "boost/stacktrace.hpp") | |
1237 | set(_Boost_SYSTEM_HEADERS "boost/system/config.hpp") | |
1238 | set(_Boost_TEST_EXEC_MONITOR_HEADERS "boost/test/test_exec_monitor.hpp") | |
1239 | set(_Boost_THREAD_HEADERS "boost/thread.hpp") | |
1240 | set(_Boost_TIMER_HEADERS "boost/timer.hpp") | |
1241 | set(_Boost_TYPE_ERASURE_HEADERS "boost/type_erasure/config.hpp") | |
1242 | set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") | |
1243 | set(_Boost_WAVE_HEADERS "boost/wave.hpp") | |
1244 | set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") | |
1245 | if(WIN32) | |
1246 | set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") | |
1247 | set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") | |
1248 | endif() | |
1249 | ||
1250 | string(TOUPPER ${component} uppercomponent) | |
1251 | set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE) | |
1252 | ||
1253 | string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}") | |
1254 | if (NOT _boost_HDRS_STRING) | |
1255 | set(_boost_HDRS_STRING "(none)") | |
1256 | endif() | |
1257 | # message(STATUS "Headers for Boost::${component}: ${_boost_HDRS_STRING}") | |
1258 | endfunction() | |
1259 | ||
1260 | # | |
1261 | # Determine if any missing dependencies require adding to the component list. | |
1262 | # | |
1263 | # Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, | |
1264 | # plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be | |
1265 | # defined; FALSE if dependency information is unavailable). | |
1266 | # | |
1267 | # componentvar - the component list variable name | |
1268 | # extravar - the indirect dependency list variable name | |
1269 | # | |
1270 | # | |
1271 | function(_Boost_MISSING_DEPENDENCIES componentvar extravar) | |
1272 | # _boost_unprocessed_components - list of components requiring processing | |
1273 | # _boost_processed_components - components already processed (or currently being processed) | |
1274 | # _boost_new_components - new components discovered for future processing | |
1275 | # | |
1276 | list(APPEND _boost_unprocessed_components ${${componentvar}}) | |
1277 | ||
1278 | while(_boost_unprocessed_components) | |
1279 | list(APPEND _boost_processed_components ${_boost_unprocessed_components}) | |
1280 | foreach(component ${_boost_unprocessed_components}) | |
1281 | string(TOUPPER ${component} uppercomponent) | |
1282 | set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) | |
1283 | _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) | |
1284 | set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) | |
1285 | set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) | |
1286 | foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) | |
1287 | if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components)) | |
1288 | list(APPEND _boost_new_components ${componentdep}) | |
1289 | endif() | |
1290 | endforeach() | |
1291 | endforeach() | |
1292 | set(_boost_unprocessed_components ${_boost_new_components}) | |
1293 | unset(_boost_new_components) | |
1294 | endwhile() | |
1295 | set(_boost_extra_components ${_boost_processed_components}) | |
1296 | if(_boost_extra_components AND ${componentvar}) | |
1297 | list(REMOVE_ITEM _boost_extra_components ${${componentvar}}) | |
1298 | endif() | |
1299 | set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) | |
1300 | set(${extravar} ${_boost_extra_components} PARENT_SCOPE) | |
1301 | endfunction() | |
1302 | ||
1303 | # | |
1304 | # Some boost libraries may require particular set of compler features. | |
1305 | # The very first one was `boost::fiber` introduced in Boost 1.62. | |
1306 | # One can check required compiler features of it in | |
494da23a TL |
1307 | # - `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`; |
1308 | # - `${Boost_ROOT}/libs/context/build/Jamfile.v2`. | |
1309 | # | |
1310 | # TODO (Re)Check compiler features on (every?) release ??? | |
1311 | # One may use the following command to get the files to check: | |
1312 | # | |
1313 | # $ find . -name Jamfile.v2 | grep build | xargs grep -l cxx1 | |
11fdf7f2 TL |
1314 | # |
1315 | function(_Boost_COMPILER_FEATURES component _ret) | |
494da23a | 1316 | # Boost >= 1.62 |
92f5a8d4 | 1317 | if(NOT Boost_VERSION_STRING VERSION_LESS 1.62.0) |
11fdf7f2 TL |
1318 | set(_Boost_FIBER_COMPILER_FEATURES |
1319 | cxx_alias_templates | |
1320 | cxx_auto_type | |
1321 | cxx_constexpr | |
1322 | cxx_defaulted_functions | |
1323 | cxx_final | |
1324 | cxx_lambdas | |
1325 | cxx_noexcept | |
1326 | cxx_nullptr | |
1327 | cxx_rvalue_references | |
1328 | cxx_thread_local | |
1329 | cxx_variadic_templates | |
1330 | ) | |
494da23a TL |
1331 | # Compiler feature for `context` same as for `fiber`. |
1332 | set(_Boost_CONTEXT_COMPILER_FEATURES ${_Boost_FIBER_COMPILER_FEATURES}) | |
11fdf7f2 | 1333 | endif() |
494da23a TL |
1334 | |
1335 | # Boost Contract library available in >= 1.67 | |
1336 | if(NOT Boost_VERSION_STRING VERSION_LESS 1.67.0) | |
1337 | # From `libs/contract/build/boost_contract_build.jam` | |
1338 | set(_Boost_CONTRACT_COMPILER_FEATURES | |
1339 | cxx_lambdas | |
1340 | cxx_variadic_templates | |
1341 | ) | |
1342 | endif() | |
1343 | ||
11fdf7f2 TL |
1344 | string(TOUPPER ${component} uppercomponent) |
1345 | set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) | |
1346 | endfunction() | |
1347 | ||
1348 | # | |
1349 | # Update library search directory hint variable with paths used by prebuilt boost binaries. | |
1350 | # | |
1351 | # Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/) | |
1352 | # have library directories named using MSVC compiler version and architecture. | |
1353 | # This function would append corresponding directories if MSVC is a current compiler, | |
1354 | # so having `BOOST_ROOT` would be enough to specify to find everything. | |
1355 | # | |
1356 | function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir) | |
1357 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") | |
1358 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) | |
1359 | set(_arch_suffix 64) | |
1360 | else() | |
1361 | set(_arch_suffix 32) | |
1362 | endif() | |
494da23a TL |
1363 | if(MSVC_TOOLSET_VERSION GREATER_EQUAL 150) |
1364 | # Not yet known. | |
1365 | elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 140) | |
1366 | # MSVC toolset 14.x versions are forward compatible. | |
1367 | foreach(v 9 8 7 6 5 4 3 2 1 0) | |
1368 | if(MSVC_TOOLSET_VERSION GREATER_EQUAL 14${v}) | |
1369 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.${v}) | |
1370 | endif() | |
1371 | endforeach() | |
11fdf7f2 TL |
1372 | elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80) |
1373 | math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10") | |
1374 | list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0) | |
1375 | endif() | |
1376 | set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE) | |
1377 | endif() | |
1378 | endfunction() | |
1379 | ||
1380 | # | |
1381 | # End functions/macros | |
1382 | # | |
1383 | #------------------------------------------------------------------------------- | |
1384 | ||
1385 | #------------------------------------------------------------------------------- | |
1386 | # main. | |
1387 | #------------------------------------------------------------------------------- | |
1388 | ||
1389 | ||
1390 | # If the user sets Boost_LIBRARY_DIR, use it as the default for both | |
1391 | # configurations. | |
1392 | if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR) | |
1393 | set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}") | |
1394 | endif() | |
1395 | if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR) | |
1396 | set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}") | |
1397 | endif() | |
1398 | ||
1399 | if(NOT DEFINED Boost_USE_DEBUG_LIBS) | |
1400 | set(Boost_USE_DEBUG_LIBS TRUE) | |
1401 | endif() | |
1402 | if(NOT DEFINED Boost_USE_RELEASE_LIBS) | |
1403 | set(Boost_USE_RELEASE_LIBS TRUE) | |
1404 | endif() | |
1405 | if(NOT DEFINED Boost_USE_MULTITHREADED) | |
1406 | set(Boost_USE_MULTITHREADED TRUE) | |
1407 | endif() | |
1408 | if(NOT DEFINED Boost_USE_DEBUG_RUNTIME) | |
1409 | set(Boost_USE_DEBUG_RUNTIME TRUE) | |
1410 | endif() | |
1411 | ||
1412 | # Check the version of Boost against the requested version. | |
1413 | if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) | |
1414 | message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") | |
1415 | endif() | |
1416 | ||
1417 | if(Boost_FIND_VERSION_EXACT) | |
1418 | # The version may appear in a directory with or without the patch | |
1419 | # level, even when the patch level is non-zero. | |
1420 | set(_boost_TEST_VERSIONS | |
1421 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" | |
1422 | "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") | |
1423 | else() | |
1424 | # The user has not requested an exact version. Among known | |
1425 | # versions, find those that are acceptable to the user request. | |
1426 | # | |
1427 | # Note: When adding a new Boost release, also update the dependency | |
1428 | # information in _Boost_COMPONENT_DEPENDENCIES and | |
1429 | # _Boost_COMPONENT_HEADERS. See the instructions at the top of | |
1430 | # _Boost_COMPONENT_DEPENDENCIES. | |
1431 | set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} | |
92f5a8d4 | 1432 | "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" |
11fdf7f2 TL |
1433 | "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" |
1434 | "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" | |
1435 | "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" | |
1436 | "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" | |
1437 | "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" | |
1438 | "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" | |
1439 | "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" | |
1440 | "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" | |
1441 | "1.34" "1.33.1" "1.33.0" "1.33") | |
1442 | ||
1443 | set(_boost_TEST_VERSIONS) | |
1444 | if(Boost_FIND_VERSION) | |
1445 | set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") | |
1446 | # Select acceptable versions. | |
1447 | foreach(version ${_Boost_KNOWN_VERSIONS}) | |
1448 | if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") | |
1449 | # This version is high enough. | |
1450 | list(APPEND _boost_TEST_VERSIONS "${version}") | |
1451 | elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") | |
1452 | # This version is a short-form for the requested version with | |
1453 | # the patch level dropped. | |
1454 | list(APPEND _boost_TEST_VERSIONS "${version}") | |
1455 | endif() | |
1456 | endforeach() | |
1457 | else() | |
1458 | # Any version is acceptable. | |
1459 | set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") | |
1460 | endif() | |
1461 | endif() | |
1462 | ||
92f5a8d4 TL |
1463 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_TEST_VERSIONS") |
1464 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_USE_MULTITHREADED") | |
1465 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_USE_STATIC_LIBS") | |
1466 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_USE_STATIC_RUNTIME") | |
1467 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_ADDITIONAL_VERSIONS") | |
1468 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_NO_SYSTEM_PATHS") | |
11fdf7f2 TL |
1469 | |
1470 | # Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It | |
1471 | # will only contain any interface definitions on WIN32, but is created | |
1472 | # on all platforms to keep end user code free from platform dependent | |
1473 | # code. Also provide convenience targets to disable autolinking and | |
1474 | # enable dynamic linking. | |
1475 | if(NOT TARGET Boost::diagnostic_definitions) | |
1476 | add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) | |
1477 | add_library(Boost::disable_autolinking INTERFACE IMPORTED) | |
1478 | add_library(Boost::dynamic_linking INTERFACE IMPORTED) | |
92f5a8d4 TL |
1479 | set_target_properties(Boost::dynamic_linking PROPERTIES |
1480 | INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") | |
11fdf7f2 TL |
1481 | endif() |
1482 | if(WIN32) | |
1483 | # In windows, automatic linking is performed, so you do not have | |
1484 | # to specify the libraries. If you are linking to a dynamic | |
1485 | # runtime, then you can choose to link to either a static or a | |
1486 | # dynamic Boost library, the default is to do a static link. You | |
1487 | # can alter this for a specific library "whatever" by defining | |
1488 | # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be | |
1489 | # linked dynamically. Alternatively you can force all Boost | |
1490 | # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. | |
1491 | ||
1492 | # This feature can be disabled for Boost library "whatever" by | |
1493 | # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining | |
1494 | # BOOST_ALL_NO_LIB. | |
1495 | ||
1496 | # If you want to observe which libraries are being linked against | |
1497 | # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking | |
1498 | # code to emit a #pragma message each time a library is selected | |
1499 | # for linking. | |
1500 | set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") | |
1501 | set_target_properties(Boost::diagnostic_definitions PROPERTIES | |
1502 | INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") | |
1503 | set_target_properties(Boost::disable_autolinking PROPERTIES | |
1504 | INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") | |
11fdf7f2 TL |
1505 | endif() |
1506 | ||
92f5a8d4 TL |
1507 | if(POLICY CMP0074) |
1508 | cmake_policy(GET CMP0074 _Boost_CMP0074) | |
1509 | if(NOT "x${_Boost_CMP0074}x" STREQUAL "xNEWx") | |
1510 | _Boost_CHECK_SPELLING(Boost_ROOT) | |
1511 | endif() | |
1512 | unset(_Boost_CMP0074) | |
1513 | else() | |
1514 | _Boost_CHECK_SPELLING(Boost_ROOT) | |
1515 | endif() | |
11fdf7f2 TL |
1516 | _Boost_CHECK_SPELLING(Boost_LIBRARYDIR) |
1517 | _Boost_CHECK_SPELLING(Boost_INCLUDEDIR) | |
1518 | ||
1519 | # Collect environment variable inputs as hints. Do not consider changes. | |
1520 | foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR) | |
1521 | set(_env $ENV{${v}}) | |
1522 | if(_env) | |
1523 | file(TO_CMAKE_PATH "${_env}" _ENV_${v}) | |
1524 | else() | |
1525 | set(_ENV_${v} "") | |
1526 | endif() | |
1527 | endforeach() | |
1528 | if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT) | |
1529 | set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}") | |
1530 | endif() | |
1531 | ||
1532 | # Collect inputs and cached results. Detect changes since the last run. | |
1533 | if(NOT BOOST_ROOT AND BOOSTROOT) | |
1534 | set(BOOST_ROOT "${BOOSTROOT}") | |
1535 | endif() | |
1536 | set(_Boost_VARS_DIR | |
1537 | BOOST_ROOT | |
1538 | Boost_NO_SYSTEM_PATHS | |
1539 | ) | |
1540 | ||
92f5a8d4 TL |
1541 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "BOOST_ROOT") |
1542 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "BOOST_ROOT" ENVIRONMENT) | |
1543 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "BOOST_INCLUDEDIR") | |
1544 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "BOOST_INCLUDEDIR" ENVIRONMENT) | |
1545 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "BOOST_LIBRARYDIR") | |
1546 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "BOOST_LIBRARYDIR" ENVIRONMENT) | |
11fdf7f2 TL |
1547 | |
1548 | # ------------------------------------------------------------------------ | |
1549 | # Search for Boost include DIR | |
1550 | # ------------------------------------------------------------------------ | |
1551 | ||
1552 | set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS) | |
1553 | _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC}) | |
1554 | # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the | |
1555 | # location did. We will find a new one based on the new inputs. | |
1556 | if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED) | |
1557 | unset(Boost_INCLUDE_DIR CACHE) | |
1558 | endif() | |
1559 | ||
1560 | if(NOT Boost_INCLUDE_DIR) | |
1561 | set(_boost_INCLUDE_SEARCH_DIRS "") | |
1562 | if(BOOST_INCLUDEDIR) | |
1563 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR}) | |
1564 | elseif(_ENV_BOOST_INCLUDEDIR) | |
1565 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR}) | |
1566 | endif() | |
1567 | ||
1568 | if( BOOST_ROOT ) | |
1569 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) | |
1570 | elseif( _ENV_BOOST_ROOT ) | |
1571 | list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT}) | |
1572 | endif() | |
1573 | ||
1574 | if( Boost_NO_SYSTEM_PATHS) | |
1575 | list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) | |
1576 | else() | |
1577 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") | |
494da23a | 1578 | foreach(ver ${_boost_TEST_VERSIONS}) |
11fdf7f2 TL |
1579 | string(REPLACE "." "_" ver "${ver}") |
1580 | list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}") | |
1581 | endforeach() | |
1582 | endif() | |
1583 | list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS | |
1584 | C:/boost/include | |
1585 | C:/boost | |
1586 | /sw/local/include | |
1587 | ) | |
1588 | endif() | |
1589 | ||
1590 | # Try to find Boost by stepping backwards through the Boost versions | |
1591 | # we know about. | |
1592 | # Build a list of path suffixes for each version. | |
1593 | set(_boost_PATH_SUFFIXES) | |
1594 | foreach(_boost_VER ${_boost_TEST_VERSIONS}) | |
1595 | # Add in a path suffix, based on the required version, ideally | |
1596 | # we could read this from version.hpp, but for that to work we'd | |
1597 | # need to know the include dir already | |
1598 | set(_boost_BOOSTIFIED_VERSION) | |
1599 | ||
1600 | # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 | |
1601 | if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") | |
1602 | set(_boost_BOOSTIFIED_VERSION | |
1603 | "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") | |
1604 | elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") | |
1605 | set(_boost_BOOSTIFIED_VERSION | |
1606 | "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") | |
1607 | endif() | |
1608 | ||
1609 | list(APPEND _boost_PATH_SUFFIXES | |
1610 | "boost-${_boost_BOOSTIFIED_VERSION}" | |
1611 | "boost_${_boost_BOOSTIFIED_VERSION}" | |
1612 | "boost/boost-${_boost_BOOSTIFIED_VERSION}" | |
1613 | "boost/boost_${_boost_BOOSTIFIED_VERSION}" | |
1614 | ) | |
1615 | ||
1616 | endforeach() | |
1617 | ||
92f5a8d4 TL |
1618 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_INCLUDE_SEARCH_DIRS") |
1619 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_PATH_SUFFIXES") | |
11fdf7f2 TL |
1620 | |
1621 | # Look for a standard boost header file. | |
1622 | find_path(Boost_INCLUDE_DIR | |
1623 | NAMES boost/config.hpp | |
1624 | HINTS ${_boost_INCLUDE_SEARCH_DIRS} | |
1625 | PATH_SUFFIXES ${_boost_PATH_SUFFIXES} | |
1626 | ) | |
1627 | endif() | |
1628 | ||
1629 | # ------------------------------------------------------------------------ | |
1630 | # Extract version information from version.hpp | |
1631 | # ------------------------------------------------------------------------ | |
1632 | ||
11fdf7f2 | 1633 | if(Boost_INCLUDE_DIR) |
92f5a8d4 TL |
1634 | _Boost_DEBUG_PRINT("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
1635 | "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") | |
11fdf7f2 | 1636 | |
92f5a8d4 TL |
1637 | # Extract Boost_VERSION_MACRO and Boost_LIB_VERSION from version.hpp |
1638 | set(Boost_VERSION_MACRO 0) | |
11fdf7f2 TL |
1639 | set(Boost_LIB_VERSION "") |
1640 | file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") | |
92f5a8d4 TL |
1641 | if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_VERSION ([0-9]+)") |
1642 | set(Boost_VERSION_MACRO "${CMAKE_MATCH_1}") | |
1643 | endif() | |
1644 | if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_LIB_VERSION \"([0-9_]+)\"") | |
1645 | set(Boost_LIB_VERSION "${CMAKE_MATCH_1}") | |
11fdf7f2 | 1646 | endif() |
92f5a8d4 | 1647 | unset(_boost_VERSION_HPP_CONTENTS) |
11fdf7f2 | 1648 | |
92f5a8d4 TL |
1649 | # Calculate version components |
1650 | math(EXPR Boost_VERSION_MAJOR "${Boost_VERSION_MACRO} / 100000") | |
1651 | math(EXPR Boost_VERSION_MINOR "${Boost_VERSION_MACRO} / 100 % 1000") | |
1652 | math(EXPR Boost_VERSION_PATCH "${Boost_VERSION_MACRO} % 100") | |
1653 | set(Boost_VERSION_COUNT 3) | |
1654 | ||
1655 | # Define alias variables for backwards compat. | |
1656 | set(Boost_MAJOR_VERSION ${Boost_VERSION_MAJOR}) | |
1657 | set(Boost_MINOR_VERSION ${Boost_VERSION_MINOR}) | |
1658 | set(Boost_SUBMINOR_VERSION ${Boost_VERSION_PATCH}) | |
1659 | ||
1660 | # Define Boost version in x.y.z format | |
1661 | set(Boost_VERSION_STRING "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}") | |
1662 | ||
1663 | # Define final Boost_VERSION | |
1664 | if(POLICY CMP0093) | |
1665 | cmake_policy(GET CMP0093 _Boost_CMP0093) | |
1666 | if("x${_Boost_CMP0093}x" STREQUAL "xNEWx") | |
1667 | set(Boost_VERSION ${Boost_VERSION_STRING}) | |
11fdf7f2 | 1668 | else() |
92f5a8d4 | 1669 | set(Boost_VERSION ${Boost_VERSION_MACRO}) |
11fdf7f2 | 1670 | endif() |
92f5a8d4 | 1671 | unset(_Boost_CMP0093) |
11fdf7f2 | 1672 | else() |
92f5a8d4 | 1673 | set(Boost_VERSION ${Boost_VERSION_MACRO}) |
11fdf7f2 | 1674 | endif() |
92f5a8d4 TL |
1675 | |
1676 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION") | |
1677 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION_STRING") | |
1678 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION_MACRO") | |
1679 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION_MAJOR") | |
1680 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION_MINOR") | |
1681 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION_PATCH") | |
1682 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_VERSION_COUNT") | |
11fdf7f2 TL |
1683 | endif() |
1684 | ||
1685 | # ------------------------------------------------------------------------ | |
1686 | # Prefix initialization | |
1687 | # ------------------------------------------------------------------------ | |
1688 | ||
1689 | set(Boost_LIB_PREFIX "") | |
1690 | if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR | |
1691 | (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) | |
1692 | set(Boost_LIB_PREFIX "lib") | |
1693 | endif() | |
1694 | ||
1695 | if ( NOT Boost_NAMESPACE ) | |
1696 | set(Boost_NAMESPACE "boost") | |
1697 | endif() | |
1698 | ||
92f5a8d4 TL |
1699 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_LIB_PREFIX") |
1700 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "Boost_NAMESPACE") | |
494da23a | 1701 | |
11fdf7f2 TL |
1702 | # ------------------------------------------------------------------------ |
1703 | # Suffix initialization and compiler suffix detection. | |
1704 | # ------------------------------------------------------------------------ | |
1705 | ||
1706 | set(_Boost_VARS_NAME | |
1707 | Boost_NAMESPACE | |
1708 | Boost_COMPILER | |
1709 | Boost_THREADAPI | |
1710 | Boost_USE_DEBUG_PYTHON | |
1711 | Boost_USE_MULTITHREADED | |
1712 | Boost_USE_STATIC_LIBS | |
1713 | Boost_USE_STATIC_RUNTIME | |
1714 | Boost_USE_STLPORT | |
1715 | Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS | |
1716 | ) | |
1717 | _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) | |
1718 | ||
1719 | # Setting some more suffixes for the library | |
1720 | if (Boost_COMPILER) | |
1721 | set(_boost_COMPILER ${Boost_COMPILER}) | |
92f5a8d4 TL |
1722 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
1723 | "_boost_COMPILER" SOURCE "user-specified via Boost_COMPILER") | |
11fdf7f2 TL |
1724 | else() |
1725 | # Attempt to guess the compiler suffix | |
1726 | # NOTE: this is not perfect yet, if you experience any issues | |
1727 | # please report them and use the Boost_COMPILER variable | |
1728 | # to work around the problems. | |
1729 | _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) | |
11fdf7f2 TL |
1730 | endif() |
1731 | ||
1732 | set (_boost_MULTITHREADED "-mt") | |
1733 | if( NOT Boost_USE_MULTITHREADED ) | |
1734 | set (_boost_MULTITHREADED "") | |
1735 | endif() | |
92f5a8d4 | 1736 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_MULTITHREADED") |
11fdf7f2 TL |
1737 | |
1738 | #====================== | |
1739 | # Systematically build up the Boost ABI tag for the 'tagged' and 'versioned' layouts | |
1740 | # http://boost.org/doc/libs/1_66_0/more/getting_started/windows.html#library-naming | |
1741 | # http://boost.org/doc/libs/1_66_0/boost/config/auto_link.hpp | |
1742 | # http://boost.org/doc/libs/1_66_0/tools/build/src/tools/common.jam | |
1743 | # http://boost.org/doc/libs/1_66_0/boostcpp.jam | |
1744 | set( _boost_RELEASE_ABI_TAG "-") | |
1745 | set( _boost_DEBUG_ABI_TAG "-") | |
1746 | # Key Use this library when: | |
1747 | # s linking statically to the C++ standard library and | |
1748 | # compiler runtime support libraries. | |
1749 | if(Boost_USE_STATIC_RUNTIME) | |
1750 | set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") | |
1751 | set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") | |
1752 | endif() | |
1753 | # g using debug versions of the standard and runtime | |
1754 | # support libraries | |
1755 | if(WIN32 AND Boost_USE_DEBUG_RUNTIME) | |
1756 | if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" | |
1757 | OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" | |
1758 | OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel") | |
1759 | string(APPEND _boost_DEBUG_ABI_TAG "g") | |
1760 | endif() | |
1761 | endif() | |
1762 | # y using special debug build of python | |
1763 | if(Boost_USE_DEBUG_PYTHON) | |
1764 | string(APPEND _boost_DEBUG_ABI_TAG "y") | |
1765 | endif() | |
1766 | # d using a debug version of your code | |
1767 | string(APPEND _boost_DEBUG_ABI_TAG "d") | |
1768 | # p using the STLport standard library rather than the | |
1769 | # default one supplied with your compiler | |
1770 | if(Boost_USE_STLPORT) | |
1771 | string(APPEND _boost_RELEASE_ABI_TAG "p") | |
1772 | string(APPEND _boost_DEBUG_ABI_TAG "p") | |
1773 | endif() | |
1774 | # n using the STLport deprecated "native iostreams" feature | |
1775 | # removed from the documentation in 1.43.0 but still present in | |
1776 | # boost/config/auto_link.hpp | |
1777 | if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) | |
1778 | string(APPEND _boost_RELEASE_ABI_TAG "n") | |
1779 | string(APPEND _boost_DEBUG_ABI_TAG "n") | |
1780 | endif() | |
1781 | ||
1782 | # -x86 Architecture and address model tag | |
1783 | # First character is the architecture, then word-size, either 32 or 64 | |
1784 | # Only used in 'versioned' layout, added in Boost 1.66.0 | |
1785 | if(DEFINED Boost_ARCHITECTURE) | |
1786 | set(_boost_ARCHITECTURE_TAG "${Boost_ARCHITECTURE}") | |
92f5a8d4 TL |
1787 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
1788 | "_boost_ARCHITECTURE_TAG" SOURCE "user-specified via Boost_ARCHITECTURE") | |
11fdf7f2 TL |
1789 | else() |
1790 | set(_boost_ARCHITECTURE_TAG "") | |
1791 | # {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers | |
92f5a8d4 | 1792 | if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION_STRING VERSION_LESS 1.66.0) |
11fdf7f2 TL |
1793 | string(APPEND _boost_ARCHITECTURE_TAG "-") |
1794 | # This needs to be kept in-sync with the section of CMakePlatformId.h.in | |
1795 | # inside 'defined(_WIN32) && defined(_MSC_VER)' | |
1796 | if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64") | |
1797 | string(APPEND _boost_ARCHITECTURE_TAG "i") | |
1798 | elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86" | |
1799 | OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64") | |
1800 | string(APPEND _boost_ARCHITECTURE_TAG "x") | |
1801 | elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM") | |
1802 | string(APPEND _boost_ARCHITECTURE_TAG "a") | |
1803 | elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS") | |
1804 | string(APPEND _boost_ARCHITECTURE_TAG "m") | |
1805 | endif() | |
1806 | ||
1807 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) | |
1808 | string(APPEND _boost_ARCHITECTURE_TAG "64") | |
1809 | else() | |
1810 | string(APPEND _boost_ARCHITECTURE_TAG "32") | |
1811 | endif() | |
1812 | endif() | |
92f5a8d4 TL |
1813 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
1814 | "_boost_ARCHITECTURE_TAG" SOURCE "detected") | |
11fdf7f2 TL |
1815 | endif() |
1816 | ||
92f5a8d4 TL |
1817 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_RELEASE_ABI_TAG") |
1818 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_DEBUG_ABI_TAG") | |
11fdf7f2 TL |
1819 | |
1820 | # ------------------------------------------------------------------------ | |
1821 | # Begin finding boost libraries | |
1822 | # ------------------------------------------------------------------------ | |
1823 | ||
1824 | set(_Boost_VARS_LIB "") | |
1825 | foreach(c DEBUG RELEASE) | |
1826 | set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c}) | |
1827 | list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}}) | |
1828 | _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR) | |
1829 | # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the | |
1830 | # location did. We will find a new one based on the new inputs. | |
1831 | if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED) | |
1832 | unset(Boost_LIBRARY_DIR_${c} CACHE) | |
1833 | endif() | |
1834 | ||
1835 | # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value. | |
1836 | if(Boost_LIBRARY_DIR_${c}) | |
1837 | set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) | |
1838 | else() | |
1839 | set(_boost_LIBRARY_SEARCH_DIRS_${c} "") | |
1840 | if(BOOST_LIBRARYDIR) | |
1841 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR}) | |
1842 | elseif(_ENV_BOOST_LIBRARYDIR) | |
1843 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR}) | |
1844 | endif() | |
1845 | ||
1846 | if(BOOST_ROOT) | |
1847 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) | |
1848 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}") | |
1849 | elseif(_ENV_BOOST_ROOT) | |
1850 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) | |
1851 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}") | |
1852 | endif() | |
1853 | ||
1854 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} | |
1855 | ${Boost_INCLUDE_DIR}/lib | |
1856 | ${Boost_INCLUDE_DIR}/../lib | |
1857 | ${Boost_INCLUDE_DIR}/stage/lib | |
1858 | ) | |
1859 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..") | |
1860 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}") | |
1861 | if( Boost_NO_SYSTEM_PATHS ) | |
1862 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) | |
1863 | else() | |
494da23a | 1864 | foreach(ver ${_boost_TEST_VERSIONS}) |
11fdf7f2 TL |
1865 | string(REPLACE "." "_" ver "${ver}") |
1866 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}") | |
1867 | endforeach() | |
1868 | _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost") | |
1869 | list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS | |
1870 | C:/boost/lib | |
1871 | C:/boost | |
1872 | /sw/local/lib | |
1873 | ) | |
1874 | endif() | |
1875 | endif() | |
1876 | endforeach() | |
1877 | ||
92f5a8d4 TL |
1878 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_LIBRARY_SEARCH_DIRS_RELEASE") |
1879 | _Boost_DEBUG_PRINT_VAR("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_boost_LIBRARY_SEARCH_DIRS_DEBUG") | |
11fdf7f2 TL |
1880 | |
1881 | # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES | |
1882 | if( Boost_USE_STATIC_LIBS ) | |
1883 | set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) | |
1884 | if(WIN32) | |
1885 | list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a) | |
1886 | else() | |
1887 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a) | |
1888 | endif() | |
1889 | endif() | |
1890 | ||
1891 | # We want to use the tag inline below without risking double dashes | |
1892 | if(_boost_RELEASE_ABI_TAG) | |
1893 | if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") | |
1894 | set(_boost_RELEASE_ABI_TAG "") | |
1895 | endif() | |
1896 | endif() | |
1897 | if(_boost_DEBUG_ABI_TAG) | |
1898 | if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") | |
1899 | set(_boost_DEBUG_ABI_TAG "") | |
1900 | endif() | |
1901 | endif() | |
1902 | ||
1903 | # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled | |
1904 | # on WIN32 was to: | |
1905 | # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) | |
1906 | # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) | |
1907 | # We maintain this behavior since changing it could break people's builds. | |
1908 | # To disable the ambiguous behavior, the user need only | |
1909 | # set Boost_USE_STATIC_RUNTIME either ON or OFF. | |
1910 | set(_boost_STATIC_RUNTIME_WORKAROUND false) | |
1911 | if(WIN32 AND Boost_USE_STATIC_LIBS) | |
1912 | if(NOT DEFINED Boost_USE_STATIC_RUNTIME) | |
1913 | set(_boost_STATIC_RUNTIME_WORKAROUND TRUE) | |
1914 | endif() | |
1915 | endif() | |
1916 | ||
1917 | # On versions < 1.35, remove the System library from the considered list | |
1918 | # since it wasn't added until 1.35. | |
92f5a8d4 TL |
1919 | if(Boost_VERSION_STRING AND Boost_FIND_COMPONENTS) |
1920 | if(Boost_VERSION_STRING VERSION_LESS 1.35.0) | |
1921 | list(REMOVE_ITEM Boost_FIND_COMPONENTS system) | |
1922 | endif() | |
11fdf7f2 TL |
1923 | endif() |
1924 | ||
1925 | # Additional components may be required via component dependencies. | |
1926 | # Add any missing components to the list. | |
1927 | _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) | |
1928 | ||
1929 | # If thread is required, get the thread libs as a dependency | |
1930 | if("thread" IN_LIST Boost_FIND_COMPONENTS) | |
1931 | if(Boost_FIND_QUIETLY) | |
1932 | set(_Boost_find_quiet QUIET) | |
1933 | else() | |
1934 | set(_Boost_find_quiet "") | |
1935 | endif() | |
1936 | find_package(Threads ${_Boost_find_quiet}) | |
1937 | unset(_Boost_find_quiet) | |
1938 | endif() | |
1939 | ||
1940 | # If the user changed any of our control inputs flush previous results. | |
1941 | if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME) | |
1942 | foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) | |
1943 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) | |
1944 | foreach(c DEBUG RELEASE) | |
1945 | set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c}) | |
1946 | unset(${_var} CACHE) | |
1947 | set(${_var} "${_var}-NOTFOUND") | |
1948 | endforeach() | |
1949 | endforeach() | |
1950 | set(_Boost_COMPONENTS_SEARCHED "") | |
1951 | endif() | |
1952 | ||
1953 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) | |
1954 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) | |
1955 | ||
1956 | set( _boost_docstring_release "Boost ${COMPONENT} library (release)") | |
1957 | set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") | |
1958 | ||
1959 | # Compute component-specific hints. | |
1960 | set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") | |
1961 | if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR | |
1962 | ${COMPONENT} STREQUAL "graph_parallel") | |
1963 | foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) | |
1964 | if(IS_ABSOLUTE "${lib}") | |
1965 | get_filename_component(libdir "${lib}" PATH) | |
1966 | string(REPLACE "\\" "/" libdir "${libdir}") | |
1967 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir}) | |
1968 | endif() | |
1969 | endforeach() | |
1970 | endif() | |
1971 | ||
1972 | # Handle Python version suffixes | |
1973 | unset(COMPONENT_PYTHON_VERSION_MAJOR) | |
1974 | unset(COMPONENT_PYTHON_VERSION_MINOR) | |
92f5a8d4 | 1975 | if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$") |
11fdf7f2 TL |
1976 | set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}") |
1977 | set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}") | |
92f5a8d4 | 1978 | elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$") |
11fdf7f2 TL |
1979 | set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}") |
1980 | set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}") | |
1981 | set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}") | |
1982 | endif() | |
1983 | ||
1984 | unset(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) | |
1985 | if (COMPONENT_PYTHON_VERSION_MINOR) | |
1986 | # Boost >= 1.67 | |
1987 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") | |
1988 | # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix) | |
1989 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") | |
1990 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") | |
1991 | # Gentoo | |
494da23a | 1992 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}.${COMPONENT_PYTHON_VERSION_MINOR}") |
11fdf7f2 TL |
1993 | # RPMs |
1994 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") | |
1995 | endif() | |
1996 | if (COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR) | |
1997 | # Boost < 1.67 | |
1998 | list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}") | |
1999 | endif() | |
2000 | ||
2001 | # Consolidate and report component-specific hints. | |
2002 | if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) | |
2003 | list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) | |
92f5a8d4 TL |
2004 | _Boost_DEBUG_PRINT("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
2005 | "Component-specific library search names for ${COMPONENT_NAME}: ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}") | |
11fdf7f2 TL |
2006 | endif() |
2007 | if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) | |
2008 | list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) | |
92f5a8d4 TL |
2009 | _Boost_DEBUG_PRINT("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
2010 | "Component-specific library search paths for ${COMPONENT}: ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}") | |
11fdf7f2 TL |
2011 | endif() |
2012 | ||
2013 | # | |
2014 | # Find headers | |
2015 | # | |
2016 | _Boost_COMPONENT_HEADERS("${COMPONENT}" Boost_${UPPERCOMPONENT}_HEADER_NAME) | |
2017 | # Look for a standard boost header file. | |
2018 | if(Boost_${UPPERCOMPONENT}_HEADER_NAME) | |
2019 | if(EXISTS "${Boost_INCLUDE_DIR}/${Boost_${UPPERCOMPONENT}_HEADER_NAME}") | |
2020 | set(Boost_${UPPERCOMPONENT}_HEADER ON) | |
2021 | else() | |
2022 | set(Boost_${UPPERCOMPONENT}_HEADER OFF) | |
2023 | endif() | |
2024 | else() | |
2025 | set(Boost_${UPPERCOMPONENT}_HEADER ON) | |
92f5a8d4 TL |
2026 | message(WARNING "No header defined for ${COMPONENT}; skipping header check " |
2027 | "(note: header-only libraries have no designated component)") | |
11fdf7f2 TL |
2028 | endif() |
2029 | ||
2030 | # | |
2031 | # Find RELEASE libraries | |
2032 | # | |
2033 | unset(_boost_RELEASE_NAMES) | |
2034 | foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT) | |
2035 | foreach(compiler IN LISTS _boost_COMPILER) | |
2036 | list(APPEND _boost_RELEASE_NAMES | |
2037 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2038 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2039 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ) |
2040 | endforeach() | |
2041 | list(APPEND _boost_RELEASE_NAMES | |
2042 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2043 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2044 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} |
2045 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} | |
2046 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) | |
2047 | if(_boost_STATIC_RUNTIME_WORKAROUND) | |
2048 | set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") | |
2049 | foreach(compiler IN LISTS _boost_COMPILER) | |
2050 | list(APPEND _boost_RELEASE_NAMES | |
2051 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2052 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2053 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) |
2054 | endforeach() | |
2055 | list(APPEND _boost_RELEASE_NAMES | |
2056 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2057 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2058 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) |
2059 | endif() | |
2060 | endforeach() | |
2061 | if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") | |
2062 | _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) | |
2063 | endif() | |
92f5a8d4 TL |
2064 | _Boost_DEBUG_PRINT("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
2065 | "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") | |
11fdf7f2 TL |
2066 | |
2067 | # if Boost_LIBRARY_DIR_RELEASE is not defined, | |
2068 | # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs | |
2069 | if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG) | |
2070 | list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG}) | |
2071 | endif() | |
2072 | ||
2073 | # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. | |
2074 | string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") | |
2075 | ||
2076 | if(Boost_USE_RELEASE_LIBS) | |
2077 | _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE | |
2078 | NAMES ${_boost_RELEASE_NAMES} | |
2079 | HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} | |
2080 | NAMES_PER_DIR | |
2081 | DOC "${_boost_docstring_release}" | |
2082 | ) | |
2083 | endif() | |
2084 | ||
2085 | # | |
2086 | # Find DEBUG libraries | |
2087 | # | |
2088 | unset(_boost_DEBUG_NAMES) | |
2089 | foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT) | |
2090 | foreach(compiler IN LISTS _boost_COMPILER) | |
2091 | list(APPEND _boost_DEBUG_NAMES | |
2092 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2093 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2094 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ) |
2095 | endforeach() | |
2096 | list(APPEND _boost_DEBUG_NAMES | |
2097 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2098 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2099 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} |
2100 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} | |
2101 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) | |
2102 | if(_boost_STATIC_RUNTIME_WORKAROUND) | |
2103 | set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") | |
2104 | foreach(compiler IN LISTS _boost_COMPILER) | |
2105 | list(APPEND _boost_DEBUG_NAMES | |
2106 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2107 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2108 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) |
2109 | endforeach() | |
2110 | list(APPEND _boost_DEBUG_NAMES | |
2111 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} | |
494da23a | 2112 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} |
11fdf7f2 TL |
2113 | ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) |
2114 | endif() | |
2115 | endforeach() | |
2116 | if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") | |
2117 | _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) | |
2118 | endif() | |
92f5a8d4 TL |
2119 | _Boost_DEBUG_PRINT("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" |
2120 | "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") | |
11fdf7f2 TL |
2121 | |
2122 | # if Boost_LIBRARY_DIR_DEBUG is not defined, | |
2123 | # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs | |
2124 | if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE) | |
2125 | list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE}) | |
2126 | endif() | |
2127 | ||
2128 | # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. | |
2129 | string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") | |
2130 | ||
2131 | if(Boost_USE_DEBUG_LIBS) | |
2132 | _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG | |
2133 | NAMES ${_boost_DEBUG_NAMES} | |
2134 | HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} | |
2135 | NAMES_PER_DIR | |
2136 | DOC "${_boost_docstring_debug}" | |
2137 | ) | |
2138 | endif () | |
2139 | ||
2140 | if(Boost_REALPATH) | |
2141 | _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") | |
2142 | _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) | |
2143 | endif() | |
2144 | ||
2145 | _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) | |
2146 | ||
2147 | # Check if component requires some compiler features | |
2148 | _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) | |
2149 | ||
2150 | endforeach() | |
2151 | ||
2152 | # Restore the original find library ordering | |
2153 | if( Boost_USE_STATIC_LIBS ) | |
2154 | set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) | |
2155 | endif() | |
2156 | ||
2157 | # ------------------------------------------------------------------------ | |
2158 | # End finding boost libraries | |
2159 | # ------------------------------------------------------------------------ | |
2160 | ||
2161 | set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) | |
2162 | set(Boost_LIBRARY_DIRS) | |
2163 | if(Boost_LIBRARY_DIR_RELEASE) | |
2164 | list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE}) | |
2165 | endif() | |
2166 | if(Boost_LIBRARY_DIR_DEBUG) | |
2167 | list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG}) | |
2168 | endif() | |
2169 | if(Boost_LIBRARY_DIRS) | |
2170 | list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) | |
2171 | endif() | |
2172 | ||
92f5a8d4 TL |
2173 | # ------------------------------------------------------------------------ |
2174 | # Call FPHSA helper, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html | |
2175 | # ------------------------------------------------------------------------ | |
11fdf7f2 | 2176 | |
92f5a8d4 TL |
2177 | # Define aliases as needed by the component handler in the FPHSA helper below |
2178 | foreach(_comp IN LISTS Boost_FIND_COMPONENTS) | |
2179 | string(TOUPPER ${_comp} _uppercomp) | |
2180 | if(DEFINED Boost_${_uppercomp}_FOUND) | |
2181 | set(Boost_${_comp}_FOUND ${Boost_${_uppercomp}_FOUND}) | |
11fdf7f2 | 2182 | endif() |
92f5a8d4 | 2183 | endforeach() |
11fdf7f2 | 2184 | |
92f5a8d4 TL |
2185 | find_package_handle_standard_args(Boost |
2186 | REQUIRED_VARS Boost_INCLUDE_DIR | |
2187 | VERSION_VAR Boost_VERSION_STRING | |
2188 | HANDLE_COMPONENTS) | |
11fdf7f2 | 2189 | |
92f5a8d4 TL |
2190 | if(Boost_FOUND) |
2191 | if( NOT Boost_LIBRARY_DIRS ) | |
11fdf7f2 TL |
2192 | # Compatibility Code for backwards compatibility with CMake |
2193 | # 2.4's FindBoost module. | |
2194 | ||
2195 | # Look for the boost library path. | |
2196 | # Note that the user may not have installed any libraries | |
2197 | # so it is quite possible the Boost_LIBRARY_DIRS may not exist. | |
2198 | set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) | |
2199 | ||
2200 | if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") | |
2201 | get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) | |
2202 | endif() | |
2203 | ||
2204 | if("${_boost_LIB_DIR}" MATCHES "/include$") | |
2205 | # Strip off the trailing "/include" in the path. | |
2206 | get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) | |
2207 | endif() | |
2208 | ||
2209 | if(EXISTS "${_boost_LIB_DIR}/lib") | |
2210 | string(APPEND _boost_LIB_DIR /lib) | |
2211 | elseif(EXISTS "${_boost_LIB_DIR}/stage/lib") | |
2212 | string(APPEND _boost_LIB_DIR "/stage/lib") | |
2213 | else() | |
2214 | set(_boost_LIB_DIR "") | |
2215 | endif() | |
2216 | ||
2217 | if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") | |
2218 | set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) | |
2219 | endif() | |
2220 | ||
2221 | endif() | |
2222 | else() | |
2223 | # Boost headers were not found so no components were found. | |
2224 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) | |
2225 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) | |
2226 | set(Boost_${UPPERCOMPONENT}_FOUND 0) | |
2227 | endforeach() | |
2228 | endif() | |
2229 | ||
2230 | # ------------------------------------------------------------------------ | |
2231 | # Add imported targets | |
2232 | # ------------------------------------------------------------------------ | |
2233 | ||
2234 | if(Boost_FOUND) | |
92f5a8d4 TL |
2235 | # The builtin CMake package in Boost 1.70+ introduces a new name |
2236 | # for the header-only lib, let's provide the same UI in module mode | |
2237 | if(NOT TARGET Boost::headers) | |
2238 | add_library(Boost::headers INTERFACE IMPORTED) | |
11fdf7f2 | 2239 | if(Boost_INCLUDE_DIRS) |
92f5a8d4 | 2240 | set_target_properties(Boost::headers PROPERTIES |
11fdf7f2 TL |
2241 | INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") |
2242 | endif() | |
2243 | endif() | |
2244 | ||
92f5a8d4 TL |
2245 | # Define the old target name for header-only libraries for backwards |
2246 | # compat. | |
2247 | if(NOT TARGET Boost::boost) | |
2248 | add_library(Boost::boost INTERFACE IMPORTED) | |
2249 | set_target_properties(Boost::boost | |
2250 | PROPERTIES INTERFACE_LINK_LIBRARIES Boost::headers) | |
2251 | endif() | |
2252 | ||
11fdf7f2 TL |
2253 | foreach(COMPONENT ${Boost_FIND_COMPONENTS}) |
2254 | if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) | |
2255 | string(TOUPPER ${COMPONENT} UPPERCOMPONENT) | |
2256 | if(Boost_${UPPERCOMPONENT}_FOUND) | |
2257 | if(Boost_USE_STATIC_LIBS) | |
2258 | add_library(Boost::${COMPONENT} STATIC IMPORTED) | |
2259 | else() | |
2260 | # Even if Boost_USE_STATIC_LIBS is OFF, we might have static | |
2261 | # libraries as a result. | |
2262 | add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) | |
2263 | endif() | |
2264 | if(Boost_INCLUDE_DIRS) | |
2265 | set_target_properties(Boost::${COMPONENT} PROPERTIES | |
2266 | INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") | |
2267 | endif() | |
2268 | if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") | |
2269 | set_target_properties(Boost::${COMPONENT} PROPERTIES | |
2270 | IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" | |
2271 | IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") | |
2272 | endif() | |
2273 | if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") | |
2274 | set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY | |
2275 | IMPORTED_CONFIGURATIONS RELEASE) | |
2276 | set_target_properties(Boost::${COMPONENT} PROPERTIES | |
2277 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" | |
2278 | IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") | |
2279 | endif() | |
2280 | if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") | |
2281 | set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY | |
2282 | IMPORTED_CONFIGURATIONS DEBUG) | |
2283 | set_target_properties(Boost::${COMPONENT} PROPERTIES | |
2284 | IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" | |
2285 | IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") | |
2286 | endif() | |
2287 | if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) | |
2288 | unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) | |
2289 | foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) | |
2290 | list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) | |
2291 | endforeach() | |
2292 | if(COMPONENT STREQUAL "thread") | |
2293 | list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) | |
2294 | endif() | |
2295 | set_target_properties(Boost::${COMPONENT} PROPERTIES | |
2296 | INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") | |
2297 | endif() | |
2298 | if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) | |
2299 | set_target_properties(Boost::${COMPONENT} PROPERTIES | |
9f95a23c | 2300 | INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}") |
11fdf7f2 TL |
2301 | endif() |
2302 | endif() | |
2303 | endif() | |
2304 | endforeach() | |
2305 | endif() | |
2306 | ||
2307 | # ------------------------------------------------------------------------ | |
92f5a8d4 | 2308 | # Finalize |
11fdf7f2 TL |
2309 | # ------------------------------------------------------------------------ |
2310 | ||
92f5a8d4 | 2311 | # Report Boost_LIBRARIES |
11fdf7f2 | 2312 | set(Boost_LIBRARIES "") |
92f5a8d4 TL |
2313 | foreach(_comp IN LISTS Boost_FIND_COMPONENTS) |
2314 | string(TOUPPER ${_comp} _uppercomp) | |
2315 | if(Boost_${_uppercomp}_FOUND) | |
2316 | list(APPEND Boost_LIBRARIES ${Boost_${_uppercomp}_LIBRARY}) | |
2317 | if(_comp STREQUAL "thread") | |
2318 | list(APPEND Boost_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) | |
11fdf7f2 TL |
2319 | endif() |
2320 | endif() | |
92f5a8d4 | 2321 | endforeach() |
11fdf7f2 TL |
2322 | |
2323 | # Configure display of cache entries in GUI. | |
2324 | foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) | |
2325 | get_property(_type CACHE ${v} PROPERTY TYPE) | |
2326 | if(_type) | |
2327 | set_property(CACHE ${v} PROPERTY ADVANCED 1) | |
2328 | if("x${_type}" STREQUAL "xUNINITIALIZED") | |
2329 | if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS") | |
2330 | set_property(CACHE ${v} PROPERTY TYPE STRING) | |
2331 | else() | |
2332 | set_property(CACHE ${v} PROPERTY TYPE PATH) | |
2333 | endif() | |
2334 | endif() | |
2335 | endif() | |
2336 | endforeach() | |
2337 | ||
2338 | # Record last used values of input variables so we can | |
2339 | # detect on the next run if the user changed them. | |
2340 | foreach(v | |
2341 | ${_Boost_VARS_INC} ${_Boost_VARS_LIB} | |
2342 | ${_Boost_VARS_DIR} ${_Boost_VARS_NAME} | |
2343 | ) | |
2344 | if(DEFINED ${v}) | |
2345 | set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") | |
2346 | else() | |
2347 | unset(_${v}_LAST CACHE) | |
2348 | endif() | |
2349 | endforeach() | |
2350 | ||
2351 | # Maintain a persistent list of components requested anywhere since | |
2352 | # the last flush. | |
2353 | set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}") | |
2354 | list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS}) | |
2355 | list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) | |
2356 | list(SORT _Boost_COMPONENTS_SEARCHED) | |
2357 | set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" | |
2358 | CACHE INTERNAL "Components requested for this build tree.") | |
2359 | ||
2360 | # Restore project's policies | |
2361 | cmake_policy(POP) |