FindBoost.cmake 95 KB

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