FindBoost.cmake 47 KB

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