FindBoost.cmake 90 KB

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