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