FindBoost.cmake 109 KB

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