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