FindBoost.cmake 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708
  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 <[email protected]>
  207. # Copyright 2007 Wengo
  208. # Copyright 2007 Mike Jackson
  209. # Copyright 2008 Andreas Pakulat <[email protected]>
  210. # Copyright 2008-2012 Philip Lowman <[email protected]>
  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)
  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 (MINGW)
  441. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  442. set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
  443. else()
  444. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  445. set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  446. endif()
  447. elseif (UNIX)
  448. if (CMAKE_COMPILER_IS_GNUCXX)
  449. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  450. set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
  451. else()
  452. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  453. # Determine which version of GCC we have.
  454. if(APPLE)
  455. if(Boost_MINOR_VERSION)
  456. if(${Boost_MINOR_VERSION} GREATER 35)
  457. # In Boost 1.36.0 and newer, the mangled compiler name used
  458. # on Mac OS X/Darwin is "xgcc".
  459. set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
  460. else()
  461. # In Boost <= 1.35.0, there is no mangled compiler name for
  462. # the Mac OS X/Darwin version of GCC.
  463. set(_boost_COMPILER "")
  464. endif()
  465. else()
  466. # We don't know the Boost version, so assume it's
  467. # pre-1.36.0.
  468. set(_boost_COMPILER "")
  469. endif()
  470. else()
  471. set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
  472. endif()
  473. endif()
  474. endif ()
  475. else()
  476. # TODO at least Boost_DEBUG here?
  477. set(_boost_COMPILER "")
  478. endif()
  479. set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
  480. endfunction()
  481. #
  482. # Get component dependencies. Requires the dependencies to have been
  483. # defined for the Boost release version.
  484. #
  485. # component - the component to check
  486. # _ret - list of library dependencies
  487. #
  488. function(_Boost_COMPONENT_DEPENDENCIES component _ret)
  489. # Note: to add a new Boost release, run
  490. #
  491. # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake
  492. #
  493. # The output may be added in a new block below. If it's the same as
  494. # the previous release, simply update the version range of the block
  495. # for the previous release.
  496. #
  497. # This information was originally generated by running
  498. # BoostScanDeps.cmake against every boost release to date supported
  499. # by FindBoost:
  500. #
  501. # % for version in /path/to/boost/sources/*
  502. # do
  503. # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake
  504. # done
  505. #
  506. # The output was then updated by search and replace with these regexes:
  507. #
  508. # - Strip message(STATUS) prefix dashes
  509. # s;^-- ;;
  510. # - Indent
  511. # s;^set(; set(;;
  512. # - Add conditionals
  513. # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx);
  514. #
  515. # This results in the logic seen below, but will require the xxxx
  516. # replacing with the following Boost release version (or the next
  517. # minor version to be released, e.g. 1.59 was the latest at the time
  518. # of writing, making 1.60 the next, so 106000 is the needed version
  519. # number). Identical consecutive releases were then merged together
  520. # by updating the end range of the first block and removing the
  521. # following redundant blocks.
  522. #
  523. # Running the script against all historical releases should be
  524. # required only if the BoostScanDeps.cmake script logic is changed.
  525. # The addition of a new release should only require it to be run
  526. # against the new release.
  527. set(_Boost_IMPORTED_TARGETS TRUE)
  528. if(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500)
  529. set(_Boost_IOSTREAMS_DEPENDENCIES regex thread)
  530. set(_Boost_REGEX_DEPENDENCIES thread)
  531. set(_Boost_WAVE_DEPENDENCIES filesystem thread)
  532. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  533. elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600)
  534. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  535. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  536. set(_Boost_MPI_DEPENDENCIES serialization)
  537. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  538. set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
  539. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  540. elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800)
  541. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  542. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  543. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
  544. set(_Boost_MPI_DEPENDENCIES serialization)
  545. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  546. set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
  547. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  548. elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300)
  549. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  550. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  551. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
  552. set(_Boost_MPI_DEPENDENCIES serialization)
  553. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  554. set(_Boost_THREAD_DEPENDENCIES date_time)
  555. set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
  556. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  557. elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400)
  558. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  559. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  560. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
  561. set(_Boost_MPI_DEPENDENCIES serialization)
  562. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  563. set(_Boost_THREAD_DEPENDENCIES date_time)
  564. set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
  565. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  566. elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500)
  567. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  568. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  569. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization)
  570. set(_Boost_MPI_DEPENDENCIES serialization)
  571. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  572. set(_Boost_THREAD_DEPENDENCIES date_time)
  573. set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time)
  574. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  575. elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700)
  576. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  577. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  578. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
  579. set(_Boost_MPI_DEPENDENCIES serialization)
  580. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  581. set(_Boost_THREAD_DEPENDENCIES date_time)
  582. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
  583. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  584. elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800)
  585. set(_Boost_CHRONO_DEPENDENCIES system)
  586. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  587. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  588. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
  589. set(_Boost_MPI_DEPENDENCIES serialization)
  590. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  591. set(_Boost_THREAD_DEPENDENCIES date_time)
  592. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
  593. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  594. elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000)
  595. set(_Boost_CHRONO_DEPENDENCIES system)
  596. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  597. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  598. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
  599. set(_Boost_MPI_DEPENDENCIES serialization)
  600. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  601. set(_Boost_THREAD_DEPENDENCIES date_time)
  602. set(_Boost_TIMER_DEPENDENCIES chrono system)
  603. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
  604. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  605. elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300)
  606. set(_Boost_CHRONO_DEPENDENCIES system)
  607. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  608. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  609. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  610. set(_Boost_MPI_DEPENDENCIES serialization)
  611. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  612. set(_Boost_THREAD_DEPENDENCIES chrono system date_time)
  613. set(_Boost_TIMER_DEPENDENCIES chrono system)
  614. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
  615. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  616. elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400)
  617. set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
  618. set(_Boost_CHRONO_DEPENDENCIES system)
  619. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  620. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  621. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  622. set(_Boost_MPI_DEPENDENCIES serialization)
  623. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  624. set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  625. set(_Boost_TIMER_DEPENDENCIES chrono system)
  626. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
  627. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  628. elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500)
  629. set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
  630. set(_Boost_CHRONO_DEPENDENCIES system)
  631. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  632. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  633. set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
  634. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  635. set(_Boost_MPI_DEPENDENCIES serialization)
  636. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  637. set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  638. set(_Boost_TIMER_DEPENDENCIES chrono system)
  639. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  640. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  641. elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600)
  642. set(_Boost_CHRONO_DEPENDENCIES system)
  643. set(_Boost_COROUTINE_DEPENDENCIES context system)
  644. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  645. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  646. set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
  647. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  648. set(_Boost_MPI_DEPENDENCIES serialization)
  649. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  650. set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  651. set(_Boost_TIMER_DEPENDENCIES chrono system)
  652. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  653. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  654. elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900)
  655. set(_Boost_CHRONO_DEPENDENCIES system)
  656. set(_Boost_COROUTINE_DEPENDENCIES context system)
  657. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  658. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  659. set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
  660. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  661. set(_Boost_MPI_DEPENDENCIES serialization)
  662. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  663. set(_Boost_RANDOM_DEPENDENCIES system)
  664. set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  665. set(_Boost_TIMER_DEPENDENCIES chrono system)
  666. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  667. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  668. elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000)
  669. set(_Boost_CHRONO_DEPENDENCIES system)
  670. set(_Boost_COROUTINE_DEPENDENCIES context system)
  671. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  672. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  673. set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic)
  674. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  675. set(_Boost_MPI_DEPENDENCIES serialization)
  676. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  677. set(_Boost_RANDOM_DEPENDENCIES system)
  678. set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  679. set(_Boost_TIMER_DEPENDENCIES chrono system)
  680. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  681. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  682. elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106200)
  683. set(_Boost_CHRONO_DEPENDENCIES system)
  684. set(_Boost_COROUTINE_DEPENDENCIES context system)
  685. set(_Boost_FILESYSTEM_DEPENDENCIES system)
  686. set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  687. set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  688. set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  689. set(_Boost_MPI_DEPENDENCIES serialization)
  690. set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
  691. set(_Boost_RANDOM_DEPENDENCIES system)
  692. set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  693. set(_Boost_TIMER_DEPENDENCIES chrono system)
  694. set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  695. set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  696. else()
  697. message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}")
  698. set(_Boost_IMPORTED_TARGETS FALSE)
  699. endif()
  700. string(TOUPPER ${component} uppercomponent)
  701. set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  702. set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
  703. string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}")
  704. if (NOT _boost_DEPS_STRING)
  705. set(_boost_DEPS_STRING "(none)")
  706. endif()
  707. # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}")
  708. endfunction()
  709. #
  710. # Determine if any missing dependencies require adding to the component list.
  711. #
  712. # Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component,
  713. # plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be
  714. # defined; FALSE if dependency information is unavailable).
  715. #
  716. # componentvar - the component list variable name
  717. # extravar - the indirect dependency list variable name
  718. #
  719. #
  720. function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
  721. # _boost_unprocessed_components - list of components requiring processing
  722. # _boost_processed_components - components already processed (or currently being processed)
  723. # _boost_new_components - new components discovered for future processing
  724. #
  725. list(APPEND _boost_unprocessed_components ${${componentvar}})
  726. while(_boost_unprocessed_components)
  727. list(APPEND _boost_processed_components ${_boost_unprocessed_components})
  728. foreach(component ${_boost_unprocessed_components})
  729. string(TOUPPER ${component} uppercomponent)
  730. set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  731. _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES)
  732. set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  733. set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
  734. foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
  735. list(FIND _boost_processed_components "${componentdep}" _boost_component_found)
  736. list(FIND _boost_new_components "${componentdep}" _boost_component_new)
  737. if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1)
  738. list(APPEND _boost_new_components ${componentdep})
  739. endif()
  740. endforeach()
  741. endforeach()
  742. set(_boost_unprocessed_components ${_boost_new_components})
  743. unset(_boost_new_components)
  744. endwhile()
  745. set(_boost_extra_components ${_boost_processed_components})
  746. if(_boost_extra_components AND ${componentvar})
  747. list(REMOVE_ITEM _boost_extra_components ${${componentvar}})
  748. endif()
  749. set(${componentvar} ${_boost_processed_components} PARENT_SCOPE)
  750. set(${extravar} ${_boost_extra_components} PARENT_SCOPE)
  751. endfunction()
  752. #
  753. # End functions/macros
  754. #
  755. #-------------------------------------------------------------------------------
  756. #-------------------------------------------------------------------------------
  757. # main.
  758. #-------------------------------------------------------------------------------
  759. # If the user sets Boost_LIBRARY_DIR, use it as the default for both
  760. # configurations.
  761. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
  762. set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
  763. endif()
  764. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
  765. set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}")
  766. endif()
  767. if(NOT DEFINED Boost_USE_MULTITHREADED)
  768. set(Boost_USE_MULTITHREADED TRUE)
  769. endif()
  770. if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
  771. set(Boost_USE_DEBUG_RUNTIME TRUE)
  772. endif()
  773. # Check the version of Boost against the requested version.
  774. if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  775. 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")
  776. endif()
  777. if(Boost_FIND_VERSION_EXACT)
  778. # The version may appear in a directory with or without the patch
  779. # level, even when the patch level is non-zero.
  780. set(_boost_TEST_VERSIONS
  781. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
  782. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  783. else()
  784. # The user has not requested an exact version. Among known
  785. # versions, find those that are acceptable to the user request.
  786. #
  787. # Note: When adding a new Boost release, also update the dependency
  788. # information in _Boost_COMPONENT_DEPENDENCIES. See the
  789. # instructions at the top of _Boost_COMPONENT_DEPENDENCIES.
  790. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
  791. "1.61.0" "1.61" "1.60.0" "1.60"
  792. "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"
  793. "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
  794. "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
  795. "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"
  796. "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"
  797. "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
  798. "1.34" "1.33.1" "1.33.0" "1.33")
  799. set(_boost_TEST_VERSIONS)
  800. if(Boost_FIND_VERSION)
  801. set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  802. # Select acceptable versions.
  803. foreach(version ${_Boost_KNOWN_VERSIONS})
  804. if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
  805. # This version is high enough.
  806. list(APPEND _boost_TEST_VERSIONS "${version}")
  807. elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
  808. # This version is a short-form for the requested version with
  809. # the patch level dropped.
  810. list(APPEND _boost_TEST_VERSIONS "${version}")
  811. endif()
  812. endforeach()
  813. else()
  814. # Any version is acceptable.
  815. set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
  816. endif()
  817. endif()
  818. # The reason that we failed to find Boost. This will be set to a
  819. # user-friendly message when we fail to find some necessary piece of
  820. # Boost.
  821. set(Boost_ERROR_REASON)
  822. if(Boost_DEBUG)
  823. # Output some of their choices
  824. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  825. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  826. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  827. "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
  828. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  829. "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
  830. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  831. "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
  832. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  833. "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
  834. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  835. "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
  836. endif()
  837. # Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It
  838. # will only contain any interface definitions on WIN32, but is created
  839. # on all platforms to keep end user code free from platform dependent
  840. # code. Also provide convenience targets to disable autolinking and
  841. # enable dynamic linking.
  842. if(NOT TARGET Boost::diagnostic_definitions)
  843. add_library(Boost::diagnostic_definitions INTERFACE IMPORTED)
  844. add_library(Boost::disable_autolinking INTERFACE IMPORTED)
  845. add_library(Boost::dynamic_linking INTERFACE IMPORTED)
  846. endif()
  847. if(WIN32)
  848. # In windows, automatic linking is performed, so you do not have
  849. # to specify the libraries. If you are linking to a dynamic
  850. # runtime, then you can choose to link to either a static or a
  851. # dynamic Boost library, the default is to do a static link. You
  852. # can alter this for a specific library "whatever" by defining
  853. # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
  854. # linked dynamically. Alternatively you can force all Boost
  855. # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
  856. # This feature can be disabled for Boost library "whatever" by
  857. # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
  858. # BOOST_ALL_NO_LIB.
  859. # If you want to observe which libraries are being linked against
  860. # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
  861. # code to emit a #pragma message each time a library is selected
  862. # for linking.
  863. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
  864. set_target_properties(Boost::diagnostic_definitions PROPERTIES
  865. INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC")
  866. set_target_properties(Boost::disable_autolinking PROPERTIES
  867. INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")
  868. set_target_properties(Boost::dynamic_linking PROPERTIES
  869. INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK")
  870. endif()
  871. _Boost_CHECK_SPELLING(Boost_ROOT)
  872. _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
  873. _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
  874. # Collect environment variable inputs as hints. Do not consider changes.
  875. foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
  876. set(_env $ENV{${v}})
  877. if(_env)
  878. file(TO_CMAKE_PATH "${_env}" _ENV_${v})
  879. else()
  880. set(_ENV_${v} "")
  881. endif()
  882. endforeach()
  883. if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
  884. set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
  885. endif()
  886. # Collect inputs and cached results. Detect changes since the last run.
  887. if(NOT BOOST_ROOT AND BOOSTROOT)
  888. set(BOOST_ROOT "${BOOSTROOT}")
  889. endif()
  890. set(_Boost_VARS_DIR
  891. BOOST_ROOT
  892. Boost_NO_SYSTEM_PATHS
  893. )
  894. if(Boost_DEBUG)
  895. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  896. "Declared as CMake or Environmental Variables:")
  897. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  898. " BOOST_ROOT = ${BOOST_ROOT}")
  899. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  900. " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
  901. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  902. " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
  903. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  904. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  905. endif()
  906. # ------------------------------------------------------------------------
  907. # Search for Boost include DIR
  908. # ------------------------------------------------------------------------
  909. set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
  910. _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
  911. # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
  912. # location did. We will find a new one based on the new inputs.
  913. if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
  914. unset(Boost_INCLUDE_DIR CACHE)
  915. endif()
  916. if(NOT Boost_INCLUDE_DIR)
  917. set(_boost_INCLUDE_SEARCH_DIRS "")
  918. if(BOOST_INCLUDEDIR)
  919. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
  920. elseif(_ENV_BOOST_INCLUDEDIR)
  921. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
  922. endif()
  923. if( BOOST_ROOT )
  924. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
  925. elseif( _ENV_BOOST_ROOT )
  926. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
  927. endif()
  928. if( Boost_NO_SYSTEM_PATHS)
  929. list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
  930. else()
  931. list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
  932. C:/boost/include
  933. C:/boost
  934. /sw/local/include
  935. )
  936. endif()
  937. # Try to find Boost by stepping backwards through the Boost versions
  938. # we know about.
  939. # Build a list of path suffixes for each version.
  940. set(_boost_PATH_SUFFIXES)
  941. foreach(_boost_VER ${_boost_TEST_VERSIONS})
  942. # Add in a path suffix, based on the required version, ideally
  943. # we could read this from version.hpp, but for that to work we'd
  944. # need to know the include dir already
  945. set(_boost_BOOSTIFIED_VERSION)
  946. # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
  947. if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
  948. set(_boost_BOOSTIFIED_VERSION
  949. "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
  950. elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
  951. set(_boost_BOOSTIFIED_VERSION
  952. "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
  953. endif()
  954. list(APPEND _boost_PATH_SUFFIXES
  955. "boost-${_boost_BOOSTIFIED_VERSION}"
  956. "boost_${_boost_BOOSTIFIED_VERSION}"
  957. "boost/boost-${_boost_BOOSTIFIED_VERSION}"
  958. "boost/boost_${_boost_BOOSTIFIED_VERSION}"
  959. )
  960. endforeach()
  961. if(Boost_DEBUG)
  962. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  963. "Include debugging info:")
  964. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  965. " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
  966. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  967. " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
  968. endif()
  969. # Look for a standard boost header file.
  970. find_path(Boost_INCLUDE_DIR
  971. NAMES boost/config.hpp
  972. HINTS ${_boost_INCLUDE_SEARCH_DIRS}
  973. PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
  974. )
  975. endif()
  976. # ------------------------------------------------------------------------
  977. # Extract version information from version.hpp
  978. # ------------------------------------------------------------------------
  979. # Set Boost_FOUND based only on header location and version.
  980. # It will be updated below for component libraries.
  981. if(Boost_INCLUDE_DIR)
  982. if(Boost_DEBUG)
  983. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  984. "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
  985. endif()
  986. # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
  987. set(Boost_VERSION 0)
  988. set(Boost_LIB_VERSION "")
  989. file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
  990. set(_Boost_VERSION_REGEX "([0-9]+)")
  991. set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
  992. foreach(v VERSION LIB_VERSION)
  993. if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
  994. set(Boost_${v} "${CMAKE_MATCH_1}")
  995. endif()
  996. endforeach()
  997. unset(_boost_VERSION_HPP_CONTENTS)
  998. math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  999. math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  1000. math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  1001. set(Boost_ERROR_REASON
  1002. "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
  1003. if(Boost_DEBUG)
  1004. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1005. "version.hpp reveals boost "
  1006. "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1007. endif()
  1008. if(Boost_FIND_VERSION)
  1009. # Set Boost_FOUND based on requested version.
  1010. set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1011. if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
  1012. set(Boost_FOUND 0)
  1013. set(_Boost_VERSION_AGE "old")
  1014. elseif(Boost_FIND_VERSION_EXACT AND
  1015. NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
  1016. set(Boost_FOUND 0)
  1017. set(_Boost_VERSION_AGE "new")
  1018. else()
  1019. set(Boost_FOUND 1)
  1020. endif()
  1021. if(NOT Boost_FOUND)
  1022. # State that we found a version of Boost that is too new or too old.
  1023. set(Boost_ERROR_REASON
  1024. "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  1025. if (Boost_FIND_VERSION_PATCH)
  1026. set(Boost_ERROR_REASON
  1027. "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
  1028. endif ()
  1029. if (NOT Boost_FIND_VERSION_EXACT)
  1030. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
  1031. endif ()
  1032. set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
  1033. endif ()
  1034. else()
  1035. # Caller will accept any Boost version.
  1036. set(Boost_FOUND 1)
  1037. endif()
  1038. else()
  1039. set(Boost_FOUND 0)
  1040. set(Boost_ERROR_REASON
  1041. "${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.")
  1042. endif()
  1043. # ------------------------------------------------------------------------
  1044. # Prefix initialization
  1045. # ------------------------------------------------------------------------
  1046. set(Boost_LIB_PREFIX "")
  1047. if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR
  1048. (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) )
  1049. set(Boost_LIB_PREFIX "lib")
  1050. endif()
  1051. if ( NOT Boost_NAMESPACE )
  1052. set(Boost_NAMESPACE "boost")
  1053. endif()
  1054. # ------------------------------------------------------------------------
  1055. # Suffix initialization and compiler suffix detection.
  1056. # ------------------------------------------------------------------------
  1057. set(_Boost_VARS_NAME
  1058. Boost_NAMESPACE
  1059. Boost_COMPILER
  1060. Boost_THREADAPI
  1061. Boost_USE_DEBUG_PYTHON
  1062. Boost_USE_MULTITHREADED
  1063. Boost_USE_STATIC_LIBS
  1064. Boost_USE_STATIC_RUNTIME
  1065. Boost_USE_STLPORT
  1066. Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  1067. )
  1068. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
  1069. # Setting some more suffixes for the library
  1070. if (Boost_COMPILER)
  1071. set(_boost_COMPILER ${Boost_COMPILER})
  1072. if(Boost_DEBUG)
  1073. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1074. "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
  1075. endif()
  1076. else()
  1077. # Attempt to guess the compiler suffix
  1078. # NOTE: this is not perfect yet, if you experience any issues
  1079. # please report them and use the Boost_COMPILER variable
  1080. # to work around the problems.
  1081. _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
  1082. if(Boost_DEBUG)
  1083. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1084. "guessed _boost_COMPILER = ${_boost_COMPILER}")
  1085. endif()
  1086. endif()
  1087. set (_boost_MULTITHREADED "-mt")
  1088. if( NOT Boost_USE_MULTITHREADED )
  1089. set (_boost_MULTITHREADED "")
  1090. endif()
  1091. if(Boost_DEBUG)
  1092. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1093. "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  1094. endif()
  1095. #======================
  1096. # Systematically build up the Boost ABI tag
  1097. # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
  1098. set( _boost_RELEASE_ABI_TAG "-")
  1099. set( _boost_DEBUG_ABI_TAG "-")
  1100. # Key Use this library when:
  1101. # s linking statically to the C++ standard library and
  1102. # compiler runtime support libraries.
  1103. if(Boost_USE_STATIC_RUNTIME)
  1104. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
  1105. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
  1106. endif()
  1107. # g using debug versions of the standard and runtime
  1108. # support libraries
  1109. if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
  1110. if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
  1111. OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  1112. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
  1113. endif()
  1114. endif()
  1115. # y using special debug build of python
  1116. if(Boost_USE_DEBUG_PYTHON)
  1117. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
  1118. endif()
  1119. # d using a debug version of your code
  1120. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
  1121. # p using the STLport standard library rather than the
  1122. # default one supplied with your compiler
  1123. if(Boost_USE_STLPORT)
  1124. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
  1125. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
  1126. endif()
  1127. # n using the STLport deprecated "native iostreams" feature
  1128. if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
  1129. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
  1130. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
  1131. endif()
  1132. if(Boost_DEBUG)
  1133. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1134. "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
  1135. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1136. "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
  1137. endif()
  1138. # ------------------------------------------------------------------------
  1139. # Begin finding boost libraries
  1140. # ------------------------------------------------------------------------
  1141. set(_Boost_VARS_LIB "")
  1142. foreach(c DEBUG RELEASE)
  1143. set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
  1144. list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
  1145. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
  1146. # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
  1147. # location did. We will find a new one based on the new inputs.
  1148. if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
  1149. unset(Boost_LIBRARY_DIR_${c} CACHE)
  1150. endif()
  1151. # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
  1152. if(Boost_LIBRARY_DIR_${c})
  1153. set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  1154. else()
  1155. set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
  1156. if(BOOST_LIBRARYDIR)
  1157. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
  1158. elseif(_ENV_BOOST_LIBRARYDIR)
  1159. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
  1160. endif()
  1161. if(BOOST_ROOT)
  1162. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
  1163. elseif(_ENV_BOOST_ROOT)
  1164. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
  1165. endif()
  1166. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
  1167. ${Boost_INCLUDE_DIR}/lib
  1168. ${Boost_INCLUDE_DIR}/../lib
  1169. ${Boost_INCLUDE_DIR}/stage/lib
  1170. )
  1171. if( Boost_NO_SYSTEM_PATHS )
  1172. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH)
  1173. else()
  1174. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
  1175. C:/boost/lib
  1176. C:/boost
  1177. /sw/local/lib
  1178. )
  1179. endif()
  1180. endif()
  1181. endforeach()
  1182. if(Boost_DEBUG)
  1183. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1184. "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
  1185. "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1186. endif()
  1187. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  1188. if( Boost_USE_STATIC_LIBS )
  1189. set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1190. if(WIN32)
  1191. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1192. else()
  1193. set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
  1194. endif()
  1195. endif()
  1196. # We want to use the tag inline below without risking double dashes
  1197. if(_boost_RELEASE_ABI_TAG)
  1198. if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
  1199. set(_boost_RELEASE_ABI_TAG "")
  1200. endif()
  1201. endif()
  1202. if(_boost_DEBUG_ABI_TAG)
  1203. if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
  1204. set(_boost_DEBUG_ABI_TAG "")
  1205. endif()
  1206. endif()
  1207. # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
  1208. # on WIN32 was to:
  1209. # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
  1210. # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
  1211. # We maintain this behavior since changing it could break people's builds.
  1212. # To disable the ambiguous behavior, the user need only
  1213. # set Boost_USE_STATIC_RUNTIME either ON or OFF.
  1214. set(_boost_STATIC_RUNTIME_WORKAROUND false)
  1215. if(WIN32 AND Boost_USE_STATIC_LIBS)
  1216. if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
  1217. set(_boost_STATIC_RUNTIME_WORKAROUND true)
  1218. endif()
  1219. endif()
  1220. # On versions < 1.35, remove the System library from the considered list
  1221. # since it wasn't added until 1.35.
  1222. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  1223. if(Boost_VERSION LESS 103500)
  1224. list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  1225. endif()
  1226. endif()
  1227. # Additional components may be required via component dependencies.
  1228. # Add any missing components to the list.
  1229. _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS)
  1230. # If thread is required, get the thread libs as a dependency
  1231. list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS)
  1232. if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1)
  1233. include(CMakeFindDependencyMacro)
  1234. find_dependency(Threads)
  1235. endif()
  1236. # If the user changed any of our control inputs flush previous results.
  1237. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
  1238. foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
  1239. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1240. foreach(c DEBUG RELEASE)
  1241. set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
  1242. unset(${_var} CACHE)
  1243. set(${_var} "${_var}-NOTFOUND")
  1244. endforeach()
  1245. endforeach()
  1246. set(_Boost_COMPONENTS_SEARCHED "")
  1247. endif()
  1248. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1249. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1250. set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
  1251. set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
  1252. # Compute component-specific hints.
  1253. set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
  1254. if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
  1255. ${COMPONENT} STREQUAL "graph_parallel")
  1256. foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
  1257. if(IS_ABSOLUTE "${lib}")
  1258. get_filename_component(libdir "${lib}" PATH)
  1259. string(REPLACE "\\" "/" libdir "${libdir}")
  1260. list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
  1261. endif()
  1262. endforeach()
  1263. endif()
  1264. # Consolidate and report component-specific hints.
  1265. if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1266. list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1267. if(Boost_DEBUG)
  1268. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1269. "Component-specific library search paths for ${COMPONENT}: "
  1270. "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
  1271. endif()
  1272. endif()
  1273. #
  1274. # Find RELEASE libraries
  1275. #
  1276. set(_boost_RELEASE_NAMES
  1277. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  1278. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1279. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  1280. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1281. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  1282. if(_boost_STATIC_RUNTIME_WORKAROUND)
  1283. set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
  1284. list(APPEND _boost_RELEASE_NAMES
  1285. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1286. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
  1287. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1288. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  1289. endif()
  1290. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1291. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
  1292. endif()
  1293. if(Boost_DEBUG)
  1294. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1295. "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
  1296. endif()
  1297. # if Boost_LIBRARY_DIR_RELEASE is not defined,
  1298. # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
  1299. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
  1300. list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
  1301. endif()
  1302. # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1303. string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
  1304. _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
  1305. NAMES ${_boost_RELEASE_NAMES}
  1306. HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1307. NAMES_PER_DIR
  1308. DOC "${_boost_docstring_release}"
  1309. )
  1310. #
  1311. # Find DEBUG libraries
  1312. #
  1313. set(_boost_DEBUG_NAMES
  1314. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  1315. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1316. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  1317. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1318. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
  1319. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  1320. if(_boost_STATIC_RUNTIME_WORKAROUND)
  1321. set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
  1322. list(APPEND _boost_DEBUG_NAMES
  1323. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1324. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
  1325. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1326. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  1327. endif()
  1328. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1329. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
  1330. endif()
  1331. if(Boost_DEBUG)
  1332. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1333. "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
  1334. endif()
  1335. # if Boost_LIBRARY_DIR_DEBUG is not defined,
  1336. # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
  1337. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
  1338. list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
  1339. endif()
  1340. # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1341. string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1342. _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
  1343. NAMES ${_boost_DEBUG_NAMES}
  1344. HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1345. NAMES_PER_DIR
  1346. DOC "${_boost_docstring_debug}"
  1347. )
  1348. if(Boost_REALPATH)
  1349. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
  1350. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
  1351. endif()
  1352. _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  1353. endforeach()
  1354. # Restore the original find library ordering
  1355. if( Boost_USE_STATIC_LIBS )
  1356. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1357. endif()
  1358. # ------------------------------------------------------------------------
  1359. # End finding boost libraries
  1360. # ------------------------------------------------------------------------
  1361. set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  1362. set(Boost_LIBRARY_DIRS)
  1363. if(Boost_LIBRARY_DIR_RELEASE)
  1364. list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
  1365. endif()
  1366. if(Boost_LIBRARY_DIR_DEBUG)
  1367. list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
  1368. endif()
  1369. if(Boost_LIBRARY_DIRS)
  1370. list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  1371. endif()
  1372. # The above setting of Boost_FOUND was based only on the header files.
  1373. # Update it for the requested component libraries.
  1374. if(Boost_FOUND)
  1375. # The headers were found. Check for requested component libs.
  1376. set(_boost_CHECKED_COMPONENT FALSE)
  1377. set(_Boost_MISSING_COMPONENTS "")
  1378. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1379. string(TOUPPER ${COMPONENT} COMPONENT)
  1380. set(_boost_CHECKED_COMPONENT TRUE)
  1381. if(NOT Boost_${COMPONENT}_FOUND)
  1382. string(TOLOWER ${COMPONENT} COMPONENT)
  1383. list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  1384. endif()
  1385. endforeach()
  1386. if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS)
  1387. # Optional indirect dependencies are not counted as missing.
  1388. list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS})
  1389. endif()
  1390. if(Boost_DEBUG)
  1391. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  1392. endif()
  1393. if (_Boost_MISSING_COMPONENTS)
  1394. set(Boost_FOUND 0)
  1395. # We were unable to find some libraries, so generate a sensible
  1396. # error message that lists the libraries we were unable to find.
  1397. set(Boost_ERROR_REASON
  1398. "${Boost_ERROR_REASON}\nCould not find the following")
  1399. if(Boost_USE_STATIC_LIBS)
  1400. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static")
  1401. endif()
  1402. set(Boost_ERROR_REASON
  1403. "${Boost_ERROR_REASON} Boost libraries:\n")
  1404. foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  1405. set(Boost_ERROR_REASON
  1406. "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n")
  1407. endforeach()
  1408. list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  1409. list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  1410. if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  1411. set(Boost_ERROR_REASON
  1412. "${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.")
  1413. else ()
  1414. set(Boost_ERROR_REASON
  1415. "${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.")
  1416. endif ()
  1417. endif ()
  1418. if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  1419. # Compatibility Code for backwards compatibility with CMake
  1420. # 2.4's FindBoost module.
  1421. # Look for the boost library path.
  1422. # Note that the user may not have installed any libraries
  1423. # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
  1424. set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  1425. if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  1426. get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1427. endif()
  1428. if("${_boost_LIB_DIR}" MATCHES "/include$")
  1429. # Strip off the trailing "/include" in the path.
  1430. get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1431. endif()
  1432. if(EXISTS "${_boost_LIB_DIR}/lib")
  1433. set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
  1434. else()
  1435. if(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1436. set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
  1437. else()
  1438. set(_boost_LIB_DIR "")
  1439. endif()
  1440. endif()
  1441. if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1442. set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
  1443. endif()
  1444. endif()
  1445. else()
  1446. # Boost headers were not found so no components were found.
  1447. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1448. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1449. set(Boost_${UPPERCOMPONENT}_FOUND 0)
  1450. endforeach()
  1451. endif()
  1452. # ------------------------------------------------------------------------
  1453. # Add imported targets
  1454. # ------------------------------------------------------------------------
  1455. if(Boost_FOUND AND _Boost_IMPORTED_TARGETS)
  1456. # For header-only libraries
  1457. if(NOT TARGET Boost::boost)
  1458. add_library(Boost::boost INTERFACE IMPORTED)
  1459. if(Boost_INCLUDE_DIRS)
  1460. set_target_properties(Boost::boost PROPERTIES
  1461. INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
  1462. endif()
  1463. endif()
  1464. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1465. if(NOT TARGET Boost::${COMPONENT})
  1466. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1467. if(Boost_${UPPERCOMPONENT}_FOUND)
  1468. if(Boost_USE_STATIC_LIBS)
  1469. add_library(Boost::${COMPONENT} STATIC IMPORTED)
  1470. else()
  1471. # Even if Boost_USE_STATIC_LIBS is OFF, we might have static
  1472. # libraries as a result.
  1473. add_library(Boost::${COMPONENT} UNKNOWN IMPORTED)
  1474. endif()
  1475. if(Boost_INCLUDE_DIRS)
  1476. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1477. INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
  1478. endif()
  1479. if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}")
  1480. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1481. IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
  1482. IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}")
  1483. endif()
  1484. if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
  1485. set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
  1486. IMPORTED_CONFIGURATIONS DEBUG)
  1487. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1488. IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  1489. IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
  1490. endif()
  1491. if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
  1492. set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
  1493. IMPORTED_CONFIGURATIONS RELEASE)
  1494. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1495. IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  1496. IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
  1497. endif()
  1498. if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES)
  1499. unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES)
  1500. foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES})
  1501. list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep})
  1502. endforeach()
  1503. if(COMPONENT STREQUAL "thread")
  1504. list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads)
  1505. endif()
  1506. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1507. INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}")
  1508. endif()
  1509. endif()
  1510. endif()
  1511. endforeach()
  1512. endif()
  1513. # ------------------------------------------------------------------------
  1514. # Notification to end user about what was found
  1515. # ------------------------------------------------------------------------
  1516. set(Boost_LIBRARIES "")
  1517. if(Boost_FOUND)
  1518. if(NOT Boost_FIND_QUIETLY)
  1519. message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1520. if(Boost_FIND_COMPONENTS)
  1521. message(STATUS "Found the following Boost libraries:")
  1522. endif()
  1523. endif()
  1524. foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
  1525. string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  1526. if( Boost_${UPPERCOMPONENT}_FOUND )
  1527. if(NOT Boost_FIND_QUIETLY)
  1528. message (STATUS " ${COMPONENT}")
  1529. endif()
  1530. list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
  1531. endif()
  1532. endforeach()
  1533. else()
  1534. if(Boost_FIND_REQUIRED)
  1535. message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  1536. else()
  1537. if(NOT Boost_FIND_QUIETLY)
  1538. # we opt not to automatically output Boost_ERROR_REASON here as
  1539. # it could be quite lengthy and somewhat imposing in its requests
  1540. # Since Boost is not always a required dependency we'll leave this
  1541. # up to the end-user.
  1542. if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
  1543. message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
  1544. else()
  1545. message(STATUS "Could NOT find Boost")
  1546. endif()
  1547. endif()
  1548. endif()
  1549. endif()
  1550. # Configure display of cache entries in GUI.
  1551. foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
  1552. get_property(_type CACHE ${v} PROPERTY TYPE)
  1553. if(_type)
  1554. set_property(CACHE ${v} PROPERTY ADVANCED 1)
  1555. if("x${_type}" STREQUAL "xUNINITIALIZED")
  1556. if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
  1557. set_property(CACHE ${v} PROPERTY TYPE STRING)
  1558. else()
  1559. set_property(CACHE ${v} PROPERTY TYPE PATH)
  1560. endif()
  1561. endif()
  1562. endif()
  1563. endforeach()
  1564. # Record last used values of input variables so we can
  1565. # detect on the next run if the user changed them.
  1566. foreach(v
  1567. ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
  1568. ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
  1569. )
  1570. if(DEFINED ${v})
  1571. set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
  1572. else()
  1573. unset(_${v}_LAST CACHE)
  1574. endif()
  1575. endforeach()
  1576. # Maintain a persistent list of components requested anywhere since
  1577. # the last flush.
  1578. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
  1579. list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
  1580. list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
  1581. list(SORT _Boost_COMPONENTS_SEARCHED)
  1582. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
  1583. CACHE INTERNAL "Components requested for this build tree.")