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