FindBoost.cmake 116 KB

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