FindBoost.cmake 88 KB

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