FindBoost.cmake 116 KB

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