FindBoost.cmake 98 KB

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