FindBoost.cmake 79 KB

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