FindBoost.cmake 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698
  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 106100)
  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. #
  718. #
  719. function(_Boost_MISSING_DEPENDENCIES componentvar)
  720. # _boost_unprocessed_components - list of components requiring processing
  721. # _boost_processed_components - components already processed (or currently being processed)
  722. # _boost_new_components - new components discovered for future processing
  723. #
  724. list(APPEND _boost_unprocessed_components ${${componentvar}})
  725. while(_boost_unprocessed_components)
  726. list(APPEND _boost_processed_components ${_boost_unprocessed_components})
  727. foreach(component ${_boost_unprocessed_components})
  728. string(TOUPPER ${component} uppercomponent)
  729. set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  730. _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES)
  731. set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  732. set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
  733. foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
  734. list(FIND _boost_processed_components "${componentdep}" _boost_component_found)
  735. list(FIND _boost_new_components "${componentdep}" _boost_component_new)
  736. if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1)
  737. list(APPEND _boost_new_components ${componentdep})
  738. endif()
  739. endforeach()
  740. endforeach()
  741. set(_boost_unprocessed_components ${_boost_new_components})
  742. unset(_boost_new_components)
  743. endwhile()
  744. set(${componentvar} ${_boost_processed_components} PARENT_SCOPE)
  745. endfunction()
  746. #
  747. # End functions/macros
  748. #
  749. #-------------------------------------------------------------------------------
  750. #-------------------------------------------------------------------------------
  751. # main.
  752. #-------------------------------------------------------------------------------
  753. # If the user sets Boost_LIBRARY_DIR, use it as the default for both
  754. # configurations.
  755. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
  756. set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
  757. endif()
  758. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
  759. set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}")
  760. endif()
  761. if(NOT DEFINED Boost_USE_MULTITHREADED)
  762. set(Boost_USE_MULTITHREADED TRUE)
  763. endif()
  764. if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
  765. set(Boost_USE_DEBUG_RUNTIME TRUE)
  766. endif()
  767. # Check the version of Boost against the requested version.
  768. if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  769. 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")
  770. endif()
  771. if(Boost_FIND_VERSION_EXACT)
  772. # The version may appear in a directory with or without the patch
  773. # level, even when the patch level is non-zero.
  774. set(_boost_TEST_VERSIONS
  775. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
  776. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  777. else()
  778. # The user has not requested an exact version. Among known
  779. # versions, find those that are acceptable to the user request.
  780. #
  781. # Note: When adding a new Boost release, also update the dependency
  782. # information in _Boost_COMPONENT_DEPENDENCIES. See the
  783. # instructions at the top of _Boost_COMPONENT_DEPENDENCIES.
  784. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
  785. "1.60.0" "1.60"
  786. "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"
  787. "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
  788. "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
  789. "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"
  790. "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"
  791. "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
  792. "1.34" "1.33.1" "1.33.0" "1.33")
  793. set(_boost_TEST_VERSIONS)
  794. if(Boost_FIND_VERSION)
  795. set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  796. # Select acceptable versions.
  797. foreach(version ${_Boost_KNOWN_VERSIONS})
  798. if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
  799. # This version is high enough.
  800. list(APPEND _boost_TEST_VERSIONS "${version}")
  801. elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
  802. # This version is a short-form for the requested version with
  803. # the patch level dropped.
  804. list(APPEND _boost_TEST_VERSIONS "${version}")
  805. endif()
  806. endforeach()
  807. else()
  808. # Any version is acceptable.
  809. set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
  810. endif()
  811. endif()
  812. # The reason that we failed to find Boost. This will be set to a
  813. # user-friendly message when we fail to find some necessary piece of
  814. # Boost.
  815. set(Boost_ERROR_REASON)
  816. if(Boost_DEBUG)
  817. # Output some of their choices
  818. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  819. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  820. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  821. "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
  822. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  823. "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
  824. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  825. "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
  826. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  827. "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
  828. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  829. "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
  830. endif()
  831. # Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It
  832. # will only contain any interface definitions on WIN32, but is created
  833. # on all platforms to keep end user code free from platform dependent
  834. # code. Also provide convenience targets to disable autolinking and
  835. # enable dynamic linking.
  836. if(NOT TARGET Boost::diagnostic_definitions)
  837. add_library(Boost::diagnostic_definitions INTERFACE IMPORTED)
  838. add_library(Boost::disable_autolinking INTERFACE IMPORTED)
  839. add_library(Boost::dynamic_linking INTERFACE IMPORTED)
  840. endif()
  841. if(WIN32)
  842. # In windows, automatic linking is performed, so you do not have
  843. # to specify the libraries. If you are linking to a dynamic
  844. # runtime, then you can choose to link to either a static or a
  845. # dynamic Boost library, the default is to do a static link. You
  846. # can alter this for a specific library "whatever" by defining
  847. # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
  848. # linked dynamically. Alternatively you can force all Boost
  849. # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
  850. # This feature can be disabled for Boost library "whatever" by
  851. # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
  852. # BOOST_ALL_NO_LIB.
  853. # If you want to observe which libraries are being linked against
  854. # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
  855. # code to emit a #pragma message each time a library is selected
  856. # for linking.
  857. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
  858. set_target_properties(Boost::diagnostic_definitions PROPERTIES
  859. INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC")
  860. set_target_properties(Boost::disable_autolinking PROPERTIES
  861. INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")
  862. set_target_properties(Boost::dynamic_linking PROPERTIES
  863. INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK")
  864. endif()
  865. _Boost_CHECK_SPELLING(Boost_ROOT)
  866. _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
  867. _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
  868. # Collect environment variable inputs as hints. Do not consider changes.
  869. foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
  870. set(_env $ENV{${v}})
  871. if(_env)
  872. file(TO_CMAKE_PATH "${_env}" _ENV_${v})
  873. else()
  874. set(_ENV_${v} "")
  875. endif()
  876. endforeach()
  877. if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
  878. set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
  879. endif()
  880. # Collect inputs and cached results. Detect changes since the last run.
  881. if(NOT BOOST_ROOT AND BOOSTROOT)
  882. set(BOOST_ROOT "${BOOSTROOT}")
  883. endif()
  884. set(_Boost_VARS_DIR
  885. BOOST_ROOT
  886. Boost_NO_SYSTEM_PATHS
  887. )
  888. if(Boost_DEBUG)
  889. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  890. "Declared as CMake or Environmental Variables:")
  891. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  892. " BOOST_ROOT = ${BOOST_ROOT}")
  893. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  894. " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
  895. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  896. " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
  897. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  898. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  899. endif()
  900. # ------------------------------------------------------------------------
  901. # Search for Boost include DIR
  902. # ------------------------------------------------------------------------
  903. set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
  904. _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
  905. # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
  906. # location did. We will find a new one based on the new inputs.
  907. if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
  908. unset(Boost_INCLUDE_DIR CACHE)
  909. endif()
  910. if(NOT Boost_INCLUDE_DIR)
  911. set(_boost_INCLUDE_SEARCH_DIRS "")
  912. if(BOOST_INCLUDEDIR)
  913. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
  914. elseif(_ENV_BOOST_INCLUDEDIR)
  915. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
  916. endif()
  917. if( BOOST_ROOT )
  918. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
  919. elseif( _ENV_BOOST_ROOT )
  920. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
  921. endif()
  922. if( Boost_NO_SYSTEM_PATHS)
  923. list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
  924. else()
  925. list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
  926. C:/boost/include
  927. C:/boost
  928. /sw/local/include
  929. )
  930. endif()
  931. # Try to find Boost by stepping backwards through the Boost versions
  932. # we know about.
  933. # Build a list of path suffixes for each version.
  934. set(_boost_PATH_SUFFIXES)
  935. foreach(_boost_VER ${_boost_TEST_VERSIONS})
  936. # Add in a path suffix, based on the required version, ideally
  937. # we could read this from version.hpp, but for that to work we'd
  938. # need to know the include dir already
  939. set(_boost_BOOSTIFIED_VERSION)
  940. # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
  941. if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
  942. set(_boost_BOOSTIFIED_VERSION
  943. "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
  944. elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
  945. set(_boost_BOOSTIFIED_VERSION
  946. "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
  947. endif()
  948. list(APPEND _boost_PATH_SUFFIXES
  949. "boost-${_boost_BOOSTIFIED_VERSION}"
  950. "boost_${_boost_BOOSTIFIED_VERSION}"
  951. "boost/boost-${_boost_BOOSTIFIED_VERSION}"
  952. "boost/boost_${_boost_BOOSTIFIED_VERSION}"
  953. )
  954. endforeach()
  955. if(Boost_DEBUG)
  956. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  957. "Include debugging info:")
  958. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  959. " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
  960. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  961. " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
  962. endif()
  963. # Look for a standard boost header file.
  964. find_path(Boost_INCLUDE_DIR
  965. NAMES boost/config.hpp
  966. HINTS ${_boost_INCLUDE_SEARCH_DIRS}
  967. PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
  968. )
  969. endif()
  970. # ------------------------------------------------------------------------
  971. # Extract version information from version.hpp
  972. # ------------------------------------------------------------------------
  973. # Set Boost_FOUND based only on header location and version.
  974. # It will be updated below for component libraries.
  975. if(Boost_INCLUDE_DIR)
  976. if(Boost_DEBUG)
  977. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  978. "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
  979. endif()
  980. # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
  981. set(Boost_VERSION 0)
  982. set(Boost_LIB_VERSION "")
  983. file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
  984. set(_Boost_VERSION_REGEX "([0-9]+)")
  985. set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
  986. foreach(v VERSION LIB_VERSION)
  987. if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
  988. set(Boost_${v} "${CMAKE_MATCH_1}")
  989. endif()
  990. endforeach()
  991. unset(_boost_VERSION_HPP_CONTENTS)
  992. math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  993. math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  994. math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  995. set(Boost_ERROR_REASON
  996. "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
  997. if(Boost_DEBUG)
  998. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  999. "version.hpp reveals boost "
  1000. "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1001. endif()
  1002. if(Boost_FIND_VERSION)
  1003. # Set Boost_FOUND based on requested version.
  1004. set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1005. if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
  1006. set(Boost_FOUND 0)
  1007. set(_Boost_VERSION_AGE "old")
  1008. elseif(Boost_FIND_VERSION_EXACT AND
  1009. NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
  1010. set(Boost_FOUND 0)
  1011. set(_Boost_VERSION_AGE "new")
  1012. else()
  1013. set(Boost_FOUND 1)
  1014. endif()
  1015. if(NOT Boost_FOUND)
  1016. # State that we found a version of Boost that is too new or too old.
  1017. set(Boost_ERROR_REASON
  1018. "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  1019. if (Boost_FIND_VERSION_PATCH)
  1020. set(Boost_ERROR_REASON
  1021. "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
  1022. endif ()
  1023. if (NOT Boost_FIND_VERSION_EXACT)
  1024. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
  1025. endif ()
  1026. set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
  1027. endif ()
  1028. else()
  1029. # Caller will accept any Boost version.
  1030. set(Boost_FOUND 1)
  1031. endif()
  1032. else()
  1033. set(Boost_FOUND 0)
  1034. set(Boost_ERROR_REASON
  1035. "${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.")
  1036. endif()
  1037. # ------------------------------------------------------------------------
  1038. # Prefix initialization
  1039. # ------------------------------------------------------------------------
  1040. set(Boost_LIB_PREFIX "")
  1041. if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR
  1042. (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) )
  1043. set(Boost_LIB_PREFIX "lib")
  1044. endif()
  1045. if ( NOT Boost_NAMESPACE )
  1046. set(Boost_NAMESPACE "boost")
  1047. endif()
  1048. # ------------------------------------------------------------------------
  1049. # Suffix initialization and compiler suffix detection.
  1050. # ------------------------------------------------------------------------
  1051. set(_Boost_VARS_NAME
  1052. Boost_NAMESPACE
  1053. Boost_COMPILER
  1054. Boost_THREADAPI
  1055. Boost_USE_DEBUG_PYTHON
  1056. Boost_USE_MULTITHREADED
  1057. Boost_USE_STATIC_LIBS
  1058. Boost_USE_STATIC_RUNTIME
  1059. Boost_USE_STLPORT
  1060. Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  1061. )
  1062. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
  1063. # Setting some more suffixes for the library
  1064. if (Boost_COMPILER)
  1065. set(_boost_COMPILER ${Boost_COMPILER})
  1066. if(Boost_DEBUG)
  1067. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1068. "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
  1069. endif()
  1070. else()
  1071. # Attempt to guess the compiler suffix
  1072. # NOTE: this is not perfect yet, if you experience any issues
  1073. # please report them and use the Boost_COMPILER variable
  1074. # to work around the problems.
  1075. _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
  1076. if(Boost_DEBUG)
  1077. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1078. "guessed _boost_COMPILER = ${_boost_COMPILER}")
  1079. endif()
  1080. endif()
  1081. set (_boost_MULTITHREADED "-mt")
  1082. if( NOT Boost_USE_MULTITHREADED )
  1083. set (_boost_MULTITHREADED "")
  1084. endif()
  1085. if(Boost_DEBUG)
  1086. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1087. "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  1088. endif()
  1089. #======================
  1090. # Systematically build up the Boost ABI tag
  1091. # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
  1092. set( _boost_RELEASE_ABI_TAG "-")
  1093. set( _boost_DEBUG_ABI_TAG "-")
  1094. # Key Use this library when:
  1095. # s linking statically to the C++ standard library and
  1096. # compiler runtime support libraries.
  1097. if(Boost_USE_STATIC_RUNTIME)
  1098. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
  1099. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
  1100. endif()
  1101. # g using debug versions of the standard and runtime
  1102. # support libraries
  1103. if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
  1104. if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
  1105. OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  1106. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
  1107. endif()
  1108. endif()
  1109. # y using special debug build of python
  1110. if(Boost_USE_DEBUG_PYTHON)
  1111. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
  1112. endif()
  1113. # d using a debug version of your code
  1114. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
  1115. # p using the STLport standard library rather than the
  1116. # default one supplied with your compiler
  1117. if(Boost_USE_STLPORT)
  1118. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
  1119. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
  1120. endif()
  1121. # n using the STLport deprecated "native iostreams" feature
  1122. if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
  1123. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
  1124. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
  1125. endif()
  1126. if(Boost_DEBUG)
  1127. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1128. "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
  1129. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1130. "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
  1131. endif()
  1132. # ------------------------------------------------------------------------
  1133. # Begin finding boost libraries
  1134. # ------------------------------------------------------------------------
  1135. set(_Boost_VARS_LIB "")
  1136. foreach(c DEBUG RELEASE)
  1137. set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
  1138. list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
  1139. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
  1140. # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
  1141. # location did. We will find a new one based on the new inputs.
  1142. if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
  1143. unset(Boost_LIBRARY_DIR_${c} CACHE)
  1144. endif()
  1145. # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
  1146. if(Boost_LIBRARY_DIR_${c})
  1147. set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  1148. else()
  1149. set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
  1150. if(BOOST_LIBRARYDIR)
  1151. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
  1152. elseif(_ENV_BOOST_LIBRARYDIR)
  1153. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
  1154. endif()
  1155. if(BOOST_ROOT)
  1156. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
  1157. elseif(_ENV_BOOST_ROOT)
  1158. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
  1159. endif()
  1160. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
  1161. ${Boost_INCLUDE_DIR}/lib
  1162. ${Boost_INCLUDE_DIR}/../lib
  1163. ${Boost_INCLUDE_DIR}/stage/lib
  1164. )
  1165. if( Boost_NO_SYSTEM_PATHS )
  1166. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH)
  1167. else()
  1168. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
  1169. C:/boost/lib
  1170. C:/boost
  1171. /sw/local/lib
  1172. )
  1173. endif()
  1174. endif()
  1175. endforeach()
  1176. if(Boost_DEBUG)
  1177. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1178. "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
  1179. "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1180. endif()
  1181. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  1182. if( Boost_USE_STATIC_LIBS )
  1183. set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1184. if(WIN32)
  1185. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1186. else()
  1187. set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
  1188. endif()
  1189. endif()
  1190. # We want to use the tag inline below without risking double dashes
  1191. if(_boost_RELEASE_ABI_TAG)
  1192. if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
  1193. set(_boost_RELEASE_ABI_TAG "")
  1194. endif()
  1195. endif()
  1196. if(_boost_DEBUG_ABI_TAG)
  1197. if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
  1198. set(_boost_DEBUG_ABI_TAG "")
  1199. endif()
  1200. endif()
  1201. # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
  1202. # on WIN32 was to:
  1203. # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
  1204. # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
  1205. # We maintain this behavior since changing it could break people's builds.
  1206. # To disable the ambiguous behavior, the user need only
  1207. # set Boost_USE_STATIC_RUNTIME either ON or OFF.
  1208. set(_boost_STATIC_RUNTIME_WORKAROUND false)
  1209. if(WIN32 AND Boost_USE_STATIC_LIBS)
  1210. if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
  1211. set(_boost_STATIC_RUNTIME_WORKAROUND true)
  1212. endif()
  1213. endif()
  1214. # On versions < 1.35, remove the System library from the considered list
  1215. # since it wasn't added until 1.35.
  1216. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  1217. if(Boost_VERSION LESS 103500)
  1218. list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  1219. endif()
  1220. endif()
  1221. # Additional components may be required via component dependencies.
  1222. # Add any missing components to the list.
  1223. _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS)
  1224. # If thread is required, get the thread libs as a dependency
  1225. list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS)
  1226. if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1)
  1227. include(CMakeFindDependencyMacro)
  1228. find_dependency(Threads)
  1229. endif()
  1230. # If the user changed any of our control inputs flush previous results.
  1231. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
  1232. foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
  1233. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1234. foreach(c DEBUG RELEASE)
  1235. set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
  1236. unset(${_var} CACHE)
  1237. set(${_var} "${_var}-NOTFOUND")
  1238. endforeach()
  1239. endforeach()
  1240. set(_Boost_COMPONENTS_SEARCHED "")
  1241. endif()
  1242. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1243. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1244. set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
  1245. set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
  1246. # Compute component-specific hints.
  1247. set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
  1248. if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
  1249. ${COMPONENT} STREQUAL "graph_parallel")
  1250. foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
  1251. if(IS_ABSOLUTE "${lib}")
  1252. get_filename_component(libdir "${lib}" PATH)
  1253. string(REPLACE "\\" "/" libdir "${libdir}")
  1254. list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
  1255. endif()
  1256. endforeach()
  1257. endif()
  1258. # Consolidate and report component-specific hints.
  1259. if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1260. list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1261. if(Boost_DEBUG)
  1262. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1263. "Component-specific library search paths for ${COMPONENT}: "
  1264. "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
  1265. endif()
  1266. endif()
  1267. #
  1268. # Find RELEASE libraries
  1269. #
  1270. set(_boost_RELEASE_NAMES
  1271. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  1272. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1273. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  1274. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1275. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  1276. if(_boost_STATIC_RUNTIME_WORKAROUND)
  1277. set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
  1278. list(APPEND _boost_RELEASE_NAMES
  1279. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1280. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
  1281. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1282. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  1283. endif()
  1284. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1285. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
  1286. endif()
  1287. if(Boost_DEBUG)
  1288. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1289. "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
  1290. endif()
  1291. # if Boost_LIBRARY_DIR_RELEASE is not defined,
  1292. # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
  1293. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
  1294. list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
  1295. endif()
  1296. # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1297. string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
  1298. _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
  1299. NAMES ${_boost_RELEASE_NAMES}
  1300. HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1301. NAMES_PER_DIR
  1302. DOC "${_boost_docstring_release}"
  1303. )
  1304. #
  1305. # Find DEBUG libraries
  1306. #
  1307. set(_boost_DEBUG_NAMES
  1308. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  1309. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1310. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  1311. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1312. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
  1313. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  1314. if(_boost_STATIC_RUNTIME_WORKAROUND)
  1315. set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
  1316. list(APPEND _boost_DEBUG_NAMES
  1317. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1318. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
  1319. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1320. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  1321. endif()
  1322. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1323. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
  1324. endif()
  1325. if(Boost_DEBUG)
  1326. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1327. "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
  1328. endif()
  1329. # if Boost_LIBRARY_DIR_DEBUG is not defined,
  1330. # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
  1331. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
  1332. list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
  1333. endif()
  1334. # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1335. string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1336. _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
  1337. NAMES ${_boost_DEBUG_NAMES}
  1338. HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1339. NAMES_PER_DIR
  1340. DOC "${_boost_docstring_debug}"
  1341. )
  1342. if(Boost_REALPATH)
  1343. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
  1344. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
  1345. endif()
  1346. _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  1347. endforeach()
  1348. # Restore the original find library ordering
  1349. if( Boost_USE_STATIC_LIBS )
  1350. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1351. endif()
  1352. # ------------------------------------------------------------------------
  1353. # End finding boost libraries
  1354. # ------------------------------------------------------------------------
  1355. set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  1356. set(Boost_LIBRARY_DIRS)
  1357. if(Boost_LIBRARY_DIR_RELEASE)
  1358. list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
  1359. endif()
  1360. if(Boost_LIBRARY_DIR_DEBUG)
  1361. list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
  1362. endif()
  1363. if(Boost_LIBRARY_DIRS)
  1364. list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  1365. endif()
  1366. # The above setting of Boost_FOUND was based only on the header files.
  1367. # Update it for the requested component libraries.
  1368. if(Boost_FOUND)
  1369. # The headers were found. Check for requested component libs.
  1370. set(_boost_CHECKED_COMPONENT FALSE)
  1371. set(_Boost_MISSING_COMPONENTS "")
  1372. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1373. string(TOUPPER ${COMPONENT} COMPONENT)
  1374. set(_boost_CHECKED_COMPONENT TRUE)
  1375. if(NOT Boost_${COMPONENT}_FOUND)
  1376. string(TOLOWER ${COMPONENT} COMPONENT)
  1377. list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  1378. endif()
  1379. endforeach()
  1380. if(Boost_DEBUG)
  1381. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  1382. endif()
  1383. if (_Boost_MISSING_COMPONENTS)
  1384. set(Boost_FOUND 0)
  1385. # We were unable to find some libraries, so generate a sensible
  1386. # error message that lists the libraries we were unable to find.
  1387. set(Boost_ERROR_REASON
  1388. "${Boost_ERROR_REASON}\nCould not find the following")
  1389. if(Boost_USE_STATIC_LIBS)
  1390. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static")
  1391. endif()
  1392. set(Boost_ERROR_REASON
  1393. "${Boost_ERROR_REASON} Boost libraries:\n")
  1394. foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  1395. set(Boost_ERROR_REASON
  1396. "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n")
  1397. endforeach()
  1398. list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  1399. list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  1400. if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  1401. set(Boost_ERROR_REASON
  1402. "${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.")
  1403. else ()
  1404. set(Boost_ERROR_REASON
  1405. "${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.")
  1406. endif ()
  1407. endif ()
  1408. if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  1409. # Compatibility Code for backwards compatibility with CMake
  1410. # 2.4's FindBoost module.
  1411. # Look for the boost library path.
  1412. # Note that the user may not have installed any libraries
  1413. # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
  1414. set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  1415. if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  1416. get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1417. endif()
  1418. if("${_boost_LIB_DIR}" MATCHES "/include$")
  1419. # Strip off the trailing "/include" in the path.
  1420. get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1421. endif()
  1422. if(EXISTS "${_boost_LIB_DIR}/lib")
  1423. set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
  1424. else()
  1425. if(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1426. set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
  1427. else()
  1428. set(_boost_LIB_DIR "")
  1429. endif()
  1430. endif()
  1431. if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1432. set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
  1433. endif()
  1434. endif()
  1435. else()
  1436. # Boost headers were not found so no components were found.
  1437. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1438. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1439. set(Boost_${UPPERCOMPONENT}_FOUND 0)
  1440. endforeach()
  1441. endif()
  1442. # ------------------------------------------------------------------------
  1443. # Add imported targets
  1444. # ------------------------------------------------------------------------
  1445. if(Boost_FOUND AND _Boost_IMPORTED_TARGETS)
  1446. # For header-only libraries
  1447. if(NOT TARGET Boost::boost)
  1448. add_library(Boost::boost INTERFACE IMPORTED)
  1449. if(Boost_INCLUDE_DIRS)
  1450. set_target_properties(Boost::boost PROPERTIES
  1451. INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
  1452. endif()
  1453. endif()
  1454. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1455. if(NOT TARGET Boost::${COMPONENT})
  1456. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1457. if(Boost_${UPPERCOMPONENT}_FOUND)
  1458. if(Boost_USE_STATIC_LIBS)
  1459. add_library(Boost::${COMPONENT} STATIC IMPORTED)
  1460. else()
  1461. # Even if Boost_USE_STATIC_LIBS is OFF, we might have static
  1462. # libraries as a result.
  1463. add_library(Boost::${COMPONENT} UNKNOWN IMPORTED)
  1464. endif()
  1465. if(Boost_INCLUDE_DIRS)
  1466. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1467. INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
  1468. endif()
  1469. if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}")
  1470. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1471. IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
  1472. IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}")
  1473. endif()
  1474. if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
  1475. set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
  1476. IMPORTED_CONFIGURATIONS DEBUG)
  1477. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1478. IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  1479. IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
  1480. endif()
  1481. if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
  1482. set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
  1483. IMPORTED_CONFIGURATIONS RELEASE)
  1484. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1485. IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  1486. IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
  1487. endif()
  1488. if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES)
  1489. unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES)
  1490. foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES})
  1491. list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep})
  1492. endforeach()
  1493. if(COMPONENT STREQUAL "thread")
  1494. list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads)
  1495. endif()
  1496. set_target_properties(Boost::${COMPONENT} PROPERTIES
  1497. INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}")
  1498. endif()
  1499. endif()
  1500. endif()
  1501. endforeach()
  1502. endif()
  1503. # ------------------------------------------------------------------------
  1504. # Notification to end user about what was found
  1505. # ------------------------------------------------------------------------
  1506. set(Boost_LIBRARIES "")
  1507. if(Boost_FOUND)
  1508. if(NOT Boost_FIND_QUIETLY)
  1509. message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1510. if(Boost_FIND_COMPONENTS)
  1511. message(STATUS "Found the following Boost libraries:")
  1512. endif()
  1513. endif()
  1514. foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
  1515. string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  1516. if( Boost_${UPPERCOMPONENT}_FOUND )
  1517. if(NOT Boost_FIND_QUIETLY)
  1518. message (STATUS " ${COMPONENT}")
  1519. endif()
  1520. list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
  1521. endif()
  1522. endforeach()
  1523. else()
  1524. if(Boost_FIND_REQUIRED)
  1525. message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  1526. else()
  1527. if(NOT Boost_FIND_QUIETLY)
  1528. # we opt not to automatically output Boost_ERROR_REASON here as
  1529. # it could be quite lengthy and somewhat imposing in its requests
  1530. # Since Boost is not always a required dependency we'll leave this
  1531. # up to the end-user.
  1532. if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
  1533. message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
  1534. else()
  1535. message(STATUS "Could NOT find Boost")
  1536. endif()
  1537. endif()
  1538. endif()
  1539. endif()
  1540. # Configure display of cache entries in GUI.
  1541. foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
  1542. get_property(_type CACHE ${v} PROPERTY TYPE)
  1543. if(_type)
  1544. set_property(CACHE ${v} PROPERTY ADVANCED 1)
  1545. if("x${_type}" STREQUAL "xUNINITIALIZED")
  1546. if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
  1547. set_property(CACHE ${v} PROPERTY TYPE STRING)
  1548. else()
  1549. set_property(CACHE ${v} PROPERTY TYPE PATH)
  1550. endif()
  1551. endif()
  1552. endif()
  1553. endforeach()
  1554. # Record last used values of input variables so we can
  1555. # detect on the next run if the user changed them.
  1556. foreach(v
  1557. ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
  1558. ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
  1559. )
  1560. if(DEFINED ${v})
  1561. set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
  1562. else()
  1563. unset(_${v}_LAST CACHE)
  1564. endif()
  1565. endforeach()
  1566. # Maintain a persistent list of components requested anywhere since
  1567. # the last flush.
  1568. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
  1569. list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
  1570. list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
  1571. list(SORT _Boost_COMPONENTS_SEARCHED)
  1572. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
  1573. CACHE INTERNAL "Components requested for this build tree.")