FindBoost.cmake 110 KB

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