FindBoost.cmake 97 KB

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