FindBoost.cmake 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298
  1. #.rst:
  2. # FindBoost
  3. # ---------
  4. #
  5. # Find Boost include dirs and libraries
  6. #
  7. # Use this module by invoking find_package with the form::
  8. #
  9. # find_package(Boost
  10. # [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0
  11. # [REQUIRED] # Fail with error if Boost is not found
  12. # [COMPONENTS <libs>...] # Boost libraries by their canonical name
  13. # ) # e.g. "date_time" for "libboost_date_time"
  14. #
  15. # This module finds headers and requested component libraries OR a CMake
  16. # package configuration file provided by a "Boost CMake" build. For the
  17. # latter case skip to the "Boost CMake" section below. For the former
  18. # case results are reported in variables::
  19. #
  20. # Boost_FOUND - True if headers and requested libraries were found
  21. # Boost_INCLUDE_DIRS - Boost include directories
  22. # Boost_LIBRARY_DIRS - Link directories for Boost libraries
  23. # Boost_LIBRARIES - Boost component libraries to be linked
  24. # Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case)
  25. # Boost_<C>_LIBRARY - Libraries to link for component <C> (may include
  26. # target_link_libraries debug/optimized keywords)
  27. # Boost_VERSION - BOOST_VERSION value from boost/version.hpp
  28. # Boost_LIB_VERSION - Version string appended to library filenames
  29. # Boost_MAJOR_VERSION - Boost major version number (X in X.y.z)
  30. # Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z)
  31. # Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
  32. # Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
  33. # - Pass to add_definitions() to have diagnostic
  34. # information about Boost's automatic linking
  35. # displayed during compilation
  36. #
  37. # This module reads hints about search locations from variables::
  38. #
  39. # BOOST_ROOT - Preferred installation prefix
  40. # (or BOOSTROOT)
  41. # BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include
  42. # BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib
  43. # Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not
  44. # specified by these hint variables. Default is OFF.
  45. # Boost_ADDITIONAL_VERSIONS
  46. # - List of Boost versions not known to this module
  47. # (Boost install locations may contain the version)
  48. #
  49. # and saves search results persistently in CMake cache entries::
  50. #
  51. # Boost_INCLUDE_DIR - Directory containing Boost headers
  52. # Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
  53. # Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries
  54. # Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant
  55. # Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
  56. #
  57. # Users may set these hints or results as cache entries. Projects
  58. # should not read these entries directly but instead use the above
  59. # result variables. Note that some hint names start in upper-case
  60. # "BOOST". One may specify these as environment variables if they are
  61. # not specified as CMake variables or cache entries.
  62. #
  63. # This module first searches for the Boost header files using the above
  64. # hint variables (excluding BOOST_LIBRARYDIR) and saves the result in
  65. # Boost_INCLUDE_DIR. Then it searches for requested component libraries
  66. # using the above hints (excluding BOOST_INCLUDEDIR and
  67. # Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR,
  68. # and the library name configuration settings below. It saves the
  69. # library directories in Boost_LIBRARY_DIR_DEBUG and
  70. # Boost_LIBRARY_DIR_RELEASE and individual library
  71. # locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE.
  72. # When one changes settings used by previous searches in the same build
  73. # tree (excluding environment variables) this module discards previous
  74. # search results affected by the changes and searches again.
  75. #
  76. # Boost libraries come in many variants encoded in their file name.
  77. # Users or projects may tell this module which variant to find by
  78. # setting variables::
  79. #
  80. # Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded
  81. # libraries ('mt' tag). Default is ON.
  82. # Boost_USE_STATIC_LIBS - Set to ON to force the use of the static
  83. # libraries. Default is OFF.
  84. # Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
  85. # libraries linked statically to the C++ runtime
  86. # ('s' tag). Default is platform dependent.
  87. # Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use
  88. # libraries linked to the MS debug C++ runtime
  89. # ('g' tag). Default is ON.
  90. # Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a
  91. # debug Python build ('y' tag). Default is OFF.
  92. # Boost_USE_STLPORT - Set to ON to use libraries compiled with
  93. # STLPort ('p' tag). Default is OFF.
  94. # Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  95. # - Set to ON to use libraries compiled with
  96. # STLPort deprecated "native iostreams"
  97. # ('n' tag). Default is OFF.
  98. # Boost_COMPILER - Set to the compiler-specific library suffix
  99. # (e.g. "-gcc43"). Default is auto-computed
  100. # for the C++ compiler in use.
  101. # Boost_THREADAPI - Suffix for "thread" component library name,
  102. # such as "pthread" or "win32". Names with
  103. # and without this suffix will both be tried.
  104. # Boost_NAMESPACE - Alternate namespace used to build boost with
  105. # e.g. if set to "myboost", will search for
  106. # myboost_thread instead of boost_thread.
  107. #
  108. # Other variables one may set to control this module are::
  109. #
  110. # Boost_DEBUG - Set to ON to enable debug output from FindBoost.
  111. # Please enable this before filing any bug report.
  112. # Boost_DETAILED_FAILURE_MSG
  113. # - Set to ON to add detailed information to the
  114. # failure message even when the REQUIRED option
  115. # is not given to the find_package call.
  116. # Boost_REALPATH - Set to ON to resolve symlinks for discovered
  117. # libraries to assist with packaging. For example,
  118. # the "system" component library may be resolved to
  119. # "/usr/lib/libboost_system.so.1.42.0" instead of
  120. # "/usr/lib/libboost_system.so". This does not
  121. # affect linking and should not be enabled unless
  122. # the user needs this information.
  123. # Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and
  124. # Boost_LIBRARY_DIR_DEBUG.
  125. #
  126. # On Visual Studio and Borland compilers Boost headers request automatic
  127. # linking to corresponding libraries. This requires matching libraries
  128. # to be linked explicitly or available in the link library search path.
  129. # In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve
  130. # dynamic linking. Boost automatic linking typically requests static
  131. # libraries with a few exceptions (such as Boost.Python). Use::
  132. #
  133. # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
  134. #
  135. # to ask Boost to report information about automatic linking requests.
  136. #
  137. # Example to find Boost headers only::
  138. #
  139. # find_package(Boost 1.36.0)
  140. # if(Boost_FOUND)
  141. # include_directories(${Boost_INCLUDE_DIRS})
  142. # add_executable(foo foo.cc)
  143. # endif()
  144. #
  145. # Example to find Boost headers and some *static* libraries::
  146. #
  147. # set(Boost_USE_STATIC_LIBS ON) # only find static libs
  148. # set(Boost_USE_MULTITHREADED ON)
  149. # set(Boost_USE_STATIC_RUNTIME OFF)
  150. # find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...)
  151. # if(Boost_FOUND)
  152. # include_directories(${Boost_INCLUDE_DIRS})
  153. # add_executable(foo foo.cc)
  154. # target_link_libraries(foo ${Boost_LIBRARIES})
  155. # endif()
  156. #
  157. # Boost CMake
  158. # ^^^^^^^^^^^
  159. #
  160. # If Boost was built using the boost-cmake project it provides a package
  161. # configuration file for use with find_package's Config mode. This
  162. # module looks for the package configuration file called
  163. # BoostConfig.cmake or boost-config.cmake and stores the result in cache
  164. # entry "Boost_DIR". If found, the package configuration file is loaded
  165. # and this module returns with no further action. See documentation of
  166. # the Boost CMake package configuration for details on what it provides.
  167. #
  168. # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
  169. #=============================================================================
  170. # Copyright 2006-2012 Kitware, Inc.
  171. # Copyright 2006-2008 Andreas Schneider <[email protected]>
  172. # Copyright 2007 Wengo
  173. # Copyright 2007 Mike Jackson
  174. # Copyright 2008 Andreas Pakulat <[email protected]>
  175. # Copyright 2008-2012 Philip Lowman <[email protected]>
  176. #
  177. # Distributed under the OSI-approved BSD License (the "License");
  178. # see accompanying file Copyright.txt for details.
  179. #
  180. # This software is distributed WITHOUT ANY WARRANTY; without even the
  181. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  182. # See the License for more information.
  183. #=============================================================================
  184. # (To distribute this file outside of CMake, substitute the full
  185. # License text for the above reference.)
  186. #-------------------------------------------------------------------------------
  187. # Before we go searching, check whether boost-cmake is available, unless the
  188. # user specifically asked NOT to search for boost-cmake.
  189. #
  190. # If Boost_DIR is set, this behaves as any find_package call would. If not,
  191. # it looks at BOOST_ROOT and BOOSTROOT to find Boost.
  192. #
  193. if (NOT Boost_NO_BOOST_CMAKE)
  194. # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives,
  195. # since these are more conventional for Boost.
  196. if ("$ENV{Boost_DIR}" STREQUAL "")
  197. if (NOT "$ENV{BOOST_ROOT}" STREQUAL "")
  198. set(ENV{Boost_DIR} $ENV{BOOST_ROOT})
  199. elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "")
  200. set(ENV{Boost_DIR} $ENV{BOOSTROOT})
  201. endif()
  202. endif()
  203. # Do the same find_package call but look specifically for the CMake version.
  204. # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
  205. # need to delegate them to this find_package call.
  206. find_package(Boost QUIET NO_MODULE)
  207. mark_as_advanced(Boost_DIR)
  208. # If we found boost-cmake, then we're done. Print out what we found.
  209. # Otherwise let the rest of the module try to find it.
  210. if (Boost_FOUND)
  211. message("Boost ${Boost_FIND_VERSION} found.")
  212. if (Boost_FIND_COMPONENTS)
  213. message("Found Boost components:")
  214. message(" ${Boost_FIND_COMPONENTS}")
  215. endif()
  216. return()
  217. endif()
  218. endif()
  219. #-------------------------------------------------------------------------------
  220. # FindBoost functions & macros
  221. #
  222. ############################################
  223. #
  224. # Check the existence of the libraries.
  225. #
  226. ############################################
  227. # This macro was taken directly from the FindQt4.cmake file that is included
  228. # with the CMake distribution. This is NOT my work. All work was done by the
  229. # original authors of the FindQt4.cmake file. Only minor modifications were
  230. # made to remove references to Qt and make this file more generally applicable
  231. # And ELSE/ENDIF pairs were removed for readability.
  232. #########################################################################
  233. macro(_Boost_ADJUST_LIB_VARS basename)
  234. if(Boost_INCLUDE_DIR )
  235. if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
  236. # if the generator supports configuration types then set
  237. # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
  238. if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  239. set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  240. else()
  241. # if there are no configuration types and CMAKE_BUILD_TYPE has no value
  242. # then just use the release libraries
  243. set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
  244. endif()
  245. # FIXME: This probably should be set for both cases
  246. set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  247. endif()
  248. # if only the release version was found, set the debug variable also to the release version
  249. if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
  250. set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
  251. set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
  252. set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
  253. endif()
  254. # if only the debug version was found, set the release variable also to the debug version
  255. if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
  256. set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
  257. set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
  258. set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
  259. endif()
  260. # If the debug & release library ends up being the same, omit the keywords
  261. if(${Boost_${basename}_LIBRARY_RELEASE} STREQUAL ${Boost_${basename}_LIBRARY_DEBUG})
  262. set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
  263. set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} )
  264. endif()
  265. if(Boost_${basename}_LIBRARY)
  266. set(Boost_${basename}_FOUND ON)
  267. endif()
  268. endif()
  269. # Make variables changeable to the advanced user
  270. mark_as_advanced(
  271. Boost_${basename}_LIBRARY_RELEASE
  272. Boost_${basename}_LIBRARY_DEBUG
  273. )
  274. endmacro()
  275. # Detect changes in used variables.
  276. # Compares the current variable value with the last one.
  277. # In short form:
  278. # v != v_LAST -> CHANGED = 1
  279. # v is defined, v_LAST not -> CHANGED = 1
  280. # v is not defined, but v_LAST is -> CHANGED = 1
  281. # otherwise -> CHANGED = 0
  282. # CHANGED is returned in variable named ${changed_var}
  283. macro(_Boost_CHANGE_DETECT changed_var)
  284. set(${changed_var} 0)
  285. foreach(v ${ARGN})
  286. if(DEFINED _Boost_COMPONENTS_SEARCHED)
  287. if(${v})
  288. if(_${v}_LAST)
  289. string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED)
  290. else()
  291. set(_${v}_CHANGED 1)
  292. endif()
  293. elseif(_${v}_LAST)
  294. set(_${v}_CHANGED 1)
  295. endif()
  296. if(_${v}_CHANGED)
  297. set(${changed_var} 1)
  298. endif()
  299. else()
  300. set(_${v}_CHANGED 0)
  301. endif()
  302. endforeach()
  303. endmacro()
  304. #
  305. # Find the given library (var).
  306. # Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
  307. #
  308. macro(_Boost_FIND_LIBRARY var build_type)
  309. find_library(${var} ${ARGN})
  310. if(${var})
  311. # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
  312. if(NOT Boost_LIBRARY_DIR_${build_type})
  313. get_filename_component(_dir "${${var}}" PATH)
  314. set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
  315. endif()
  316. elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  317. # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
  318. find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
  319. endif()
  320. # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
  321. if(Boost_LIBRARY_DIR_${build_type})
  322. set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  323. if(Boost_DEBUG)
  324. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  325. " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
  326. " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
  327. endif()
  328. endif()
  329. endmacro()
  330. #-------------------------------------------------------------------------------
  331. #
  332. # Runs compiler with "-dumpversion" and parses major/minor
  333. # version with a regex.
  334. #
  335. function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
  336. exec_program(${CMAKE_CXX_COMPILER}
  337. ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
  338. OUTPUT_VARIABLE _boost_COMPILER_VERSION
  339. )
  340. string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
  341. _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
  342. set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
  343. endfunction()
  344. #
  345. # Take a list of libraries with "thread" in it
  346. # and prepend duplicates with "thread_${Boost_THREADAPI}"
  347. # at the front of the list
  348. #
  349. function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
  350. set(_orig_libnames ${ARGN})
  351. string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}")
  352. set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
  353. endfunction()
  354. #
  355. # If a library is found, replace its cache entry with its REALPATH
  356. #
  357. function(_Boost_SWAP_WITH_REALPATH _library _docstring)
  358. if(${_library})
  359. get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
  360. unset(${_library} CACHE)
  361. set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
  362. endif()
  363. endfunction()
  364. function(_Boost_CHECK_SPELLING _var)
  365. if(${_var})
  366. string(TOUPPER ${_var} _var_UC)
  367. message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.")
  368. endif()
  369. endfunction()
  370. # Guesses Boost's compiler prefix used in built library names
  371. # Returns the guess by setting the variable pointed to by _ret
  372. function(_Boost_GUESS_COMPILER_PREFIX _ret)
  373. if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
  374. OR CMAKE_CXX_COMPILER MATCHES "icl"
  375. OR CMAKE_CXX_COMPILER MATCHES "icpc")
  376. if(WIN32)
  377. set (_boost_COMPILER "-iw")
  378. else()
  379. set (_boost_COMPILER "-il")
  380. endif()
  381. elseif (GHSMULTI)
  382. set(_boost_COMPILER "-ghs")
  383. elseif (MSVC14)
  384. set(_boost_COMPILER "-vc140")
  385. elseif (MSVC12)
  386. set(_boost_COMPILER "-vc120")
  387. elseif (MSVC11)
  388. set(_boost_COMPILER "-vc110")
  389. elseif (MSVC10)
  390. set(_boost_COMPILER "-vc100")
  391. elseif (MSVC90)
  392. set(_boost_COMPILER "-vc90")
  393. elseif (MSVC80)
  394. set(_boost_COMPILER "-vc80")
  395. elseif (MSVC71)
  396. set(_boost_COMPILER "-vc71")
  397. elseif (MSVC70) # Good luck!
  398. set(_boost_COMPILER "-vc7") # yes, this is correct
  399. elseif (MSVC60) # Good luck!
  400. set(_boost_COMPILER "-vc6") # yes, this is correct
  401. elseif (BORLAND)
  402. set(_boost_COMPILER "-bcb")
  403. elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
  404. set(_boost_COMPILER "-sw")
  405. elseif (MINGW)
  406. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  407. set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
  408. else()
  409. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  410. set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  411. endif()
  412. elseif (UNIX)
  413. if (CMAKE_COMPILER_IS_GNUCXX)
  414. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  415. set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
  416. else()
  417. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  418. # Determine which version of GCC we have.
  419. if(APPLE)
  420. if(Boost_MINOR_VERSION)
  421. if(${Boost_MINOR_VERSION} GREATER 35)
  422. # In Boost 1.36.0 and newer, the mangled compiler name used
  423. # on Mac OS X/Darwin is "xgcc".
  424. set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
  425. else()
  426. # In Boost <= 1.35.0, there is no mangled compiler name for
  427. # the Mac OS X/Darwin version of GCC.
  428. set(_boost_COMPILER "")
  429. endif()
  430. else()
  431. # We don't know the Boost version, so assume it's
  432. # pre-1.36.0.
  433. set(_boost_COMPILER "")
  434. endif()
  435. else()
  436. set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
  437. endif()
  438. endif()
  439. endif ()
  440. else()
  441. # TODO at least Boost_DEBUG here?
  442. set(_boost_COMPILER "")
  443. endif()
  444. set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
  445. endfunction()
  446. #
  447. # End functions/macros
  448. #
  449. #-------------------------------------------------------------------------------
  450. #-------------------------------------------------------------------------------
  451. # main.
  452. #-------------------------------------------------------------------------------
  453. # If the user sets Boost_LIBRARY_DIR, use it as the default for both
  454. # configurations.
  455. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
  456. set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
  457. endif()
  458. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
  459. set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}")
  460. endif()
  461. if(NOT DEFINED Boost_USE_MULTITHREADED)
  462. set(Boost_USE_MULTITHREADED TRUE)
  463. endif()
  464. if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
  465. set(Boost_USE_DEBUG_RUNTIME TRUE)
  466. endif()
  467. # Check the version of Boost against the requested version.
  468. if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  469. 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")
  470. endif()
  471. if(Boost_FIND_VERSION_EXACT)
  472. # The version may appear in a directory with or without the patch
  473. # level, even when the patch level is non-zero.
  474. set(_boost_TEST_VERSIONS
  475. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
  476. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  477. else()
  478. # The user has not requested an exact version. Among known
  479. # versions, find those that are acceptable to the user request.
  480. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
  481. "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"
  482. "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
  483. "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
  484. "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"
  485. "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"
  486. "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
  487. "1.34" "1.33.1" "1.33.0" "1.33")
  488. set(_boost_TEST_VERSIONS)
  489. if(Boost_FIND_VERSION)
  490. set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  491. # Select acceptable versions.
  492. foreach(version ${_Boost_KNOWN_VERSIONS})
  493. if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
  494. # This version is high enough.
  495. list(APPEND _boost_TEST_VERSIONS "${version}")
  496. elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
  497. # This version is a short-form for the requested version with
  498. # the patch level dropped.
  499. list(APPEND _boost_TEST_VERSIONS "${version}")
  500. endif()
  501. endforeach()
  502. else()
  503. # Any version is acceptable.
  504. set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
  505. endif()
  506. endif()
  507. # The reason that we failed to find Boost. This will be set to a
  508. # user-friendly message when we fail to find some necessary piece of
  509. # Boost.
  510. set(Boost_ERROR_REASON)
  511. if(Boost_DEBUG)
  512. # Output some of their choices
  513. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  514. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  515. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  516. "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
  517. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  518. "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
  519. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  520. "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
  521. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  522. "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
  523. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  524. "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
  525. endif()
  526. if(WIN32)
  527. # In windows, automatic linking is performed, so you do not have
  528. # to specify the libraries. If you are linking to a dynamic
  529. # runtime, then you can choose to link to either a static or a
  530. # dynamic Boost library, the default is to do a static link. You
  531. # can alter this for a specific library "whatever" by defining
  532. # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
  533. # linked dynamically. Alternatively you can force all Boost
  534. # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
  535. # This feature can be disabled for Boost library "whatever" by
  536. # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
  537. # BOOST_ALL_NO_LIB.
  538. # If you want to observe which libraries are being linked against
  539. # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
  540. # code to emit a #pragma message each time a library is selected
  541. # for linking.
  542. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
  543. endif()
  544. _Boost_CHECK_SPELLING(Boost_ROOT)
  545. _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
  546. _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
  547. # Collect environment variable inputs as hints. Do not consider changes.
  548. foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
  549. set(_env $ENV{${v}})
  550. if(_env)
  551. file(TO_CMAKE_PATH "${_env}" _ENV_${v})
  552. else()
  553. set(_ENV_${v} "")
  554. endif()
  555. endforeach()
  556. if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
  557. set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
  558. endif()
  559. # Collect inputs and cached results. Detect changes since the last run.
  560. if(NOT BOOST_ROOT AND BOOSTROOT)
  561. set(BOOST_ROOT "${BOOSTROOT}")
  562. endif()
  563. set(_Boost_VARS_DIR
  564. BOOST_ROOT
  565. Boost_NO_SYSTEM_PATHS
  566. )
  567. if(Boost_DEBUG)
  568. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  569. "Declared as CMake or Environmental Variables:")
  570. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  571. " BOOST_ROOT = ${BOOST_ROOT}")
  572. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  573. " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
  574. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  575. " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
  576. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  577. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  578. endif()
  579. # ------------------------------------------------------------------------
  580. # Search for Boost include DIR
  581. # ------------------------------------------------------------------------
  582. set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
  583. _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
  584. # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
  585. # location did. We will find a new one based on the new inputs.
  586. if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
  587. unset(Boost_INCLUDE_DIR CACHE)
  588. endif()
  589. if(NOT Boost_INCLUDE_DIR)
  590. set(_boost_INCLUDE_SEARCH_DIRS "")
  591. if(BOOST_INCLUDEDIR)
  592. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
  593. elseif(_ENV_BOOST_INCLUDEDIR)
  594. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
  595. endif()
  596. if( BOOST_ROOT )
  597. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
  598. elseif( _ENV_BOOST_ROOT )
  599. list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
  600. endif()
  601. if( Boost_NO_SYSTEM_PATHS)
  602. list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
  603. else()
  604. list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
  605. C:/boost/include
  606. C:/boost
  607. /sw/local/include
  608. )
  609. endif()
  610. # Try to find Boost by stepping backwards through the Boost versions
  611. # we know about.
  612. # Build a list of path suffixes for each version.
  613. set(_boost_PATH_SUFFIXES)
  614. foreach(_boost_VER ${_boost_TEST_VERSIONS})
  615. # Add in a path suffix, based on the required version, ideally
  616. # we could read this from version.hpp, but for that to work we'd
  617. # need to know the include dir already
  618. set(_boost_BOOSTIFIED_VERSION)
  619. # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
  620. if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
  621. set(_boost_BOOSTIFIED_VERSION
  622. "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
  623. elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
  624. set(_boost_BOOSTIFIED_VERSION
  625. "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
  626. endif()
  627. list(APPEND _boost_PATH_SUFFIXES
  628. "boost-${_boost_BOOSTIFIED_VERSION}"
  629. "boost_${_boost_BOOSTIFIED_VERSION}"
  630. "boost/boost-${_boost_BOOSTIFIED_VERSION}"
  631. "boost/boost_${_boost_BOOSTIFIED_VERSION}"
  632. )
  633. endforeach()
  634. if(Boost_DEBUG)
  635. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  636. "Include debugging info:")
  637. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  638. " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
  639. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  640. " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
  641. endif()
  642. # Look for a standard boost header file.
  643. find_path(Boost_INCLUDE_DIR
  644. NAMES boost/config.hpp
  645. HINTS ${_boost_INCLUDE_SEARCH_DIRS}
  646. PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
  647. )
  648. endif()
  649. # ------------------------------------------------------------------------
  650. # Extract version information from version.hpp
  651. # ------------------------------------------------------------------------
  652. # Set Boost_FOUND based only on header location and version.
  653. # It will be updated below for component libraries.
  654. if(Boost_INCLUDE_DIR)
  655. if(Boost_DEBUG)
  656. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  657. "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
  658. endif()
  659. # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
  660. set(Boost_VERSION 0)
  661. set(Boost_LIB_VERSION "")
  662. file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
  663. set(_Boost_VERSION_REGEX "([0-9]+)")
  664. set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
  665. foreach(v VERSION LIB_VERSION)
  666. if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
  667. set(Boost_${v} "${CMAKE_MATCH_1}")
  668. endif()
  669. endforeach()
  670. unset(_boost_VERSION_HPP_CONTENTS)
  671. math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  672. math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  673. math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  674. set(Boost_ERROR_REASON
  675. "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
  676. if(Boost_DEBUG)
  677. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  678. "version.hpp reveals boost "
  679. "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  680. endif()
  681. if(Boost_FIND_VERSION)
  682. # Set Boost_FOUND based on requested version.
  683. set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  684. if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
  685. set(Boost_FOUND 0)
  686. set(_Boost_VERSION_AGE "old")
  687. elseif(Boost_FIND_VERSION_EXACT AND
  688. NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
  689. set(Boost_FOUND 0)
  690. set(_Boost_VERSION_AGE "new")
  691. else()
  692. set(Boost_FOUND 1)
  693. endif()
  694. if(NOT Boost_FOUND)
  695. # State that we found a version of Boost that is too new or too old.
  696. set(Boost_ERROR_REASON
  697. "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  698. if (Boost_FIND_VERSION_PATCH)
  699. set(Boost_ERROR_REASON
  700. "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
  701. endif ()
  702. if (NOT Boost_FIND_VERSION_EXACT)
  703. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
  704. endif ()
  705. set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
  706. endif ()
  707. else()
  708. # Caller will accept any Boost version.
  709. set(Boost_FOUND 1)
  710. endif()
  711. else()
  712. set(Boost_FOUND 0)
  713. set(Boost_ERROR_REASON
  714. "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
  715. endif()
  716. # ------------------------------------------------------------------------
  717. # Prefix initialization
  718. # ------------------------------------------------------------------------
  719. set(Boost_LIB_PREFIX "")
  720. if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR
  721. (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) )
  722. set(Boost_LIB_PREFIX "lib")
  723. endif()
  724. if ( NOT Boost_NAMESPACE )
  725. set(Boost_NAMESPACE "boost")
  726. endif()
  727. # ------------------------------------------------------------------------
  728. # Suffix initialization and compiler suffix detection.
  729. # ------------------------------------------------------------------------
  730. set(_Boost_VARS_NAME
  731. Boost_NAMESPACE
  732. Boost_COMPILER
  733. Boost_THREADAPI
  734. Boost_USE_DEBUG_PYTHON
  735. Boost_USE_MULTITHREADED
  736. Boost_USE_STATIC_LIBS
  737. Boost_USE_STATIC_RUNTIME
  738. Boost_USE_STLPORT
  739. Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  740. )
  741. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
  742. # Setting some more suffixes for the library
  743. if (Boost_COMPILER)
  744. set(_boost_COMPILER ${Boost_COMPILER})
  745. if(Boost_DEBUG)
  746. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  747. "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
  748. endif()
  749. else()
  750. # Attempt to guess the compiler suffix
  751. # NOTE: this is not perfect yet, if you experience any issues
  752. # please report them and use the Boost_COMPILER variable
  753. # to work around the problems.
  754. _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
  755. if(Boost_DEBUG)
  756. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  757. "guessed _boost_COMPILER = ${_boost_COMPILER}")
  758. endif()
  759. endif()
  760. set (_boost_MULTITHREADED "-mt")
  761. if( NOT Boost_USE_MULTITHREADED )
  762. set (_boost_MULTITHREADED "")
  763. endif()
  764. if(Boost_DEBUG)
  765. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  766. "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  767. endif()
  768. #======================
  769. # Systematically build up the Boost ABI tag
  770. # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
  771. set( _boost_RELEASE_ABI_TAG "-")
  772. set( _boost_DEBUG_ABI_TAG "-")
  773. # Key Use this library when:
  774. # s linking statically to the C++ standard library and
  775. # compiler runtime support libraries.
  776. if(Boost_USE_STATIC_RUNTIME)
  777. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
  778. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
  779. endif()
  780. # g using debug versions of the standard and runtime
  781. # support libraries
  782. if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
  783. if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
  784. OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  785. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
  786. endif()
  787. endif()
  788. # y using special debug build of python
  789. if(Boost_USE_DEBUG_PYTHON)
  790. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
  791. endif()
  792. # d using a debug version of your code
  793. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
  794. # p using the STLport standard library rather than the
  795. # default one supplied with your compiler
  796. if(Boost_USE_STLPORT)
  797. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
  798. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
  799. endif()
  800. # n using the STLport deprecated "native iostreams" feature
  801. if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
  802. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
  803. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
  804. endif()
  805. if(Boost_DEBUG)
  806. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  807. "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
  808. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  809. "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
  810. endif()
  811. # ------------------------------------------------------------------------
  812. # Begin finding boost libraries
  813. # ------------------------------------------------------------------------
  814. set(_Boost_VARS_LIB "")
  815. foreach(c DEBUG RELEASE)
  816. set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
  817. list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
  818. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
  819. # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
  820. # location did. We will find a new one based on the new inputs.
  821. if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
  822. unset(Boost_LIBRARY_DIR_${c} CACHE)
  823. endif()
  824. # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
  825. if(Boost_LIBRARY_DIR_${c})
  826. set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  827. else()
  828. set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
  829. if(BOOST_LIBRARYDIR)
  830. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
  831. elseif(_ENV_BOOST_LIBRARYDIR)
  832. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
  833. endif()
  834. if(BOOST_ROOT)
  835. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
  836. elseif(_ENV_BOOST_ROOT)
  837. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
  838. endif()
  839. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
  840. ${Boost_INCLUDE_DIR}/lib
  841. ${Boost_INCLUDE_DIR}/../lib
  842. ${Boost_INCLUDE_DIR}/stage/lib
  843. )
  844. if( Boost_NO_SYSTEM_PATHS )
  845. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH)
  846. else()
  847. list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
  848. C:/boost/lib
  849. C:/boost
  850. /sw/local/lib
  851. )
  852. endif()
  853. endif()
  854. endforeach()
  855. if(Boost_DEBUG)
  856. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  857. "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
  858. "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  859. endif()
  860. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  861. if( Boost_USE_STATIC_LIBS )
  862. set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  863. if(WIN32)
  864. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  865. else()
  866. set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
  867. endif()
  868. endif()
  869. # We want to use the tag inline below without risking double dashes
  870. if(_boost_RELEASE_ABI_TAG)
  871. if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
  872. set(_boost_RELEASE_ABI_TAG "")
  873. endif()
  874. endif()
  875. if(_boost_DEBUG_ABI_TAG)
  876. if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
  877. set(_boost_DEBUG_ABI_TAG "")
  878. endif()
  879. endif()
  880. # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
  881. # on WIN32 was to:
  882. # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
  883. # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
  884. # We maintain this behavior since changing it could break people's builds.
  885. # To disable the ambiguous behavior, the user need only
  886. # set Boost_USE_STATIC_RUNTIME either ON or OFF.
  887. set(_boost_STATIC_RUNTIME_WORKAROUND false)
  888. if(WIN32 AND Boost_USE_STATIC_LIBS)
  889. if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
  890. set(_boost_STATIC_RUNTIME_WORKAROUND true)
  891. endif()
  892. endif()
  893. # On versions < 1.35, remove the System library from the considered list
  894. # since it wasn't added until 1.35.
  895. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  896. if(Boost_VERSION LESS 103500)
  897. list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  898. endif()
  899. endif()
  900. # If the user changed any of our control inputs flush previous results.
  901. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
  902. foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
  903. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  904. foreach(c DEBUG RELEASE)
  905. set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
  906. unset(${_var} CACHE)
  907. set(${_var} "${_var}-NOTFOUND")
  908. endforeach()
  909. endforeach()
  910. set(_Boost_COMPONENTS_SEARCHED "")
  911. endif()
  912. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  913. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  914. set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
  915. set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
  916. # Compute component-specific hints.
  917. set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
  918. if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
  919. ${COMPONENT} STREQUAL "graph_parallel")
  920. foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
  921. if(IS_ABSOLUTE "${lib}")
  922. get_filename_component(libdir "${lib}" PATH)
  923. string(REPLACE "\\" "/" libdir "${libdir}")
  924. list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
  925. endif()
  926. endforeach()
  927. endif()
  928. # Consolidate and report component-specific hints.
  929. if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  930. list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  931. if(Boost_DEBUG)
  932. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  933. "Component-specific library search paths for ${COMPONENT}: "
  934. "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
  935. endif()
  936. endif()
  937. #
  938. # Find RELEASE libraries
  939. #
  940. set(_boost_RELEASE_NAMES
  941. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  942. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  943. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  944. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  945. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  946. if(_boost_STATIC_RUNTIME_WORKAROUND)
  947. set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
  948. list(APPEND _boost_RELEASE_NAMES
  949. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  950. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
  951. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  952. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  953. endif()
  954. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  955. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
  956. endif()
  957. if(Boost_DEBUG)
  958. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  959. "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
  960. endif()
  961. # if Boost_LIBRARY_DIR_RELEASE is not defined,
  962. # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
  963. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
  964. list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
  965. endif()
  966. # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  967. string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
  968. _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
  969. NAMES ${_boost_RELEASE_NAMES}
  970. HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  971. NAMES_PER_DIR
  972. DOC "${_boost_docstring_release}"
  973. )
  974. #
  975. # Find DEBUG libraries
  976. #
  977. set(_boost_DEBUG_NAMES
  978. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  979. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  980. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  981. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  982. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
  983. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  984. if(_boost_STATIC_RUNTIME_WORKAROUND)
  985. set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
  986. list(APPEND _boost_DEBUG_NAMES
  987. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  988. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
  989. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  990. ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  991. endif()
  992. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  993. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
  994. endif()
  995. if(Boost_DEBUG)
  996. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  997. "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
  998. endif()
  999. # if Boost_LIBRARY_DIR_DEBUG is not defined,
  1000. # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
  1001. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
  1002. list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
  1003. endif()
  1004. # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1005. string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1006. _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
  1007. NAMES ${_boost_DEBUG_NAMES}
  1008. HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1009. NAMES_PER_DIR
  1010. DOC "${_boost_docstring_debug}"
  1011. )
  1012. if(Boost_REALPATH)
  1013. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
  1014. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
  1015. endif()
  1016. _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  1017. endforeach()
  1018. # Restore the original find library ordering
  1019. if( Boost_USE_STATIC_LIBS )
  1020. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1021. endif()
  1022. # ------------------------------------------------------------------------
  1023. # End finding boost libraries
  1024. # ------------------------------------------------------------------------
  1025. set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  1026. set(Boost_LIBRARY_DIRS)
  1027. if(Boost_LIBRARY_DIR_RELEASE)
  1028. list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
  1029. endif()
  1030. if(Boost_LIBRARY_DIR_DEBUG)
  1031. list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
  1032. endif()
  1033. if(Boost_LIBRARY_DIRS)
  1034. list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  1035. endif()
  1036. # The above setting of Boost_FOUND was based only on the header files.
  1037. # Update it for the requested component libraries.
  1038. if(Boost_FOUND)
  1039. # The headers were found. Check for requested component libs.
  1040. set(_boost_CHECKED_COMPONENT FALSE)
  1041. set(_Boost_MISSING_COMPONENTS "")
  1042. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1043. string(TOUPPER ${COMPONENT} COMPONENT)
  1044. set(_boost_CHECKED_COMPONENT TRUE)
  1045. if(NOT Boost_${COMPONENT}_FOUND)
  1046. string(TOLOWER ${COMPONENT} COMPONENT)
  1047. list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  1048. endif()
  1049. endforeach()
  1050. if(Boost_DEBUG)
  1051. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  1052. endif()
  1053. if (_Boost_MISSING_COMPONENTS)
  1054. set(Boost_FOUND 0)
  1055. # We were unable to find some libraries, so generate a sensible
  1056. # error message that lists the libraries we were unable to find.
  1057. set(Boost_ERROR_REASON
  1058. "${Boost_ERROR_REASON}\nCould not find the following")
  1059. if(Boost_USE_STATIC_LIBS)
  1060. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static")
  1061. endif()
  1062. set(Boost_ERROR_REASON
  1063. "${Boost_ERROR_REASON} Boost libraries:\n")
  1064. foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  1065. set(Boost_ERROR_REASON
  1066. "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n")
  1067. endforeach()
  1068. list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  1069. list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  1070. if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  1071. set(Boost_ERROR_REASON
  1072. "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
  1073. else ()
  1074. set(Boost_ERROR_REASON
  1075. "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
  1076. endif ()
  1077. endif ()
  1078. if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  1079. # Compatibility Code for backwards compatibility with CMake
  1080. # 2.4's FindBoost module.
  1081. # Look for the boost library path.
  1082. # Note that the user may not have installed any libraries
  1083. # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
  1084. set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  1085. if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  1086. get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1087. endif()
  1088. if("${_boost_LIB_DIR}" MATCHES "/include$")
  1089. # Strip off the trailing "/include" in the path.
  1090. get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1091. endif()
  1092. if(EXISTS "${_boost_LIB_DIR}/lib")
  1093. set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
  1094. else()
  1095. if(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1096. set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
  1097. else()
  1098. set(_boost_LIB_DIR "")
  1099. endif()
  1100. endif()
  1101. if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1102. set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
  1103. endif()
  1104. endif()
  1105. else()
  1106. # Boost headers were not found so no components were found.
  1107. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1108. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1109. set(Boost_${UPPERCOMPONENT}_FOUND 0)
  1110. endforeach()
  1111. endif()
  1112. # ------------------------------------------------------------------------
  1113. # Notification to end user about what was found
  1114. # ------------------------------------------------------------------------
  1115. set(Boost_LIBRARIES "")
  1116. if(Boost_FOUND)
  1117. if(NOT Boost_FIND_QUIETLY)
  1118. message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1119. if(Boost_FIND_COMPONENTS)
  1120. message(STATUS "Found the following Boost libraries:")
  1121. endif()
  1122. endif()
  1123. foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
  1124. string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  1125. if( Boost_${UPPERCOMPONENT}_FOUND )
  1126. if(NOT Boost_FIND_QUIETLY)
  1127. message (STATUS " ${COMPONENT}")
  1128. endif()
  1129. list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
  1130. endif()
  1131. endforeach()
  1132. else()
  1133. if(Boost_FIND_REQUIRED)
  1134. message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  1135. else()
  1136. if(NOT Boost_FIND_QUIETLY)
  1137. # we opt not to automatically output Boost_ERROR_REASON here as
  1138. # it could be quite lengthy and somewhat imposing in its requests
  1139. # Since Boost is not always a required dependency we'll leave this
  1140. # up to the end-user.
  1141. if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
  1142. message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
  1143. else()
  1144. message(STATUS "Could NOT find Boost")
  1145. endif()
  1146. endif()
  1147. endif()
  1148. endif()
  1149. # Configure display of cache entries in GUI.
  1150. foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
  1151. get_property(_type CACHE ${v} PROPERTY TYPE)
  1152. if(_type)
  1153. set_property(CACHE ${v} PROPERTY ADVANCED 1)
  1154. if("x${_type}" STREQUAL "xUNINITIALIZED")
  1155. if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
  1156. set_property(CACHE ${v} PROPERTY TYPE STRING)
  1157. else()
  1158. set_property(CACHE ${v} PROPERTY TYPE PATH)
  1159. endif()
  1160. endif()
  1161. endif()
  1162. endforeach()
  1163. # Record last used values of input variables so we can
  1164. # detect on the next run if the user changed them.
  1165. foreach(v
  1166. ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
  1167. ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
  1168. )
  1169. if(DEFINED ${v})
  1170. set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
  1171. else()
  1172. unset(_${v}_LAST CACHE)
  1173. endif()
  1174. endforeach()
  1175. # Maintain a persistent list of components requested anywhere since
  1176. # the last flush.
  1177. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
  1178. list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
  1179. list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
  1180. list(SORT _Boost_COMPONENTS_SEARCHED)
  1181. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
  1182. CACHE INTERNAL "Components requested for this build tree.")