FindBoost.cmake 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. # - Try to find Boost include dirs and libraries
  2. # Usage of this module as follows:
  3. #
  4. # == Using Header-Only libraries from within Boost: ==
  5. #
  6. # find_package( Boost 1.36.0 )
  7. # if(Boost_FOUND)
  8. # include_directories(${Boost_INCLUDE_DIRS})
  9. # add_executable(foo foo.cc)
  10. # endif()
  11. #
  12. #
  13. # == Using actual libraries from within Boost: ==
  14. #
  15. # set(Boost_USE_STATIC_LIBS ON)
  16. # set(Boost_USE_MULTITHREADED ON)
  17. # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
  18. #
  19. # if(Boost_FOUND)
  20. # include_directories(${Boost_INCLUDE_DIRS})
  21. # add_executable(foo foo.cc)
  22. # target_link_libraries(foo ${Boost_LIBRARIES})
  23. # endif()
  24. #
  25. #
  26. # The components list needs to contain actual names of boost libraries only,
  27. # such as "date_time" for "libboost_date_time". If you're using parts of
  28. # Boost that contain header files only (e.g. foreach) you do not need to
  29. # specify COMPONENTS.
  30. #
  31. # You should provide a minimum version number that should be used. If you provide this
  32. # version number and specify the REQUIRED attribute, this module will fail if it
  33. # can't find the specified or a later version. If you specify a version number this is
  34. # automatically put into the considered list of version numbers and thus doesn't need
  35. # to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
  36. #
  37. # NOTE for Visual Studio Users:
  38. # Automatic linking is used on MSVC & Borland compilers by default when
  39. # #including things in Boost. It's important to note that setting
  40. # Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
  41. # should you need this feature. Automatic linking typically uses static
  42. # libraries with a few exceptions (Boost.Python is one).
  43. #
  44. # Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
  45. # more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example
  46. # above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
  47. # gets set to OFF. It is suggested you avoid automatic linking since it
  48. # will make your application less portable.
  49. #
  50. # =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
  51. #
  52. # OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
  53. # boost version numbers that should be taken into account when searching
  54. # for Boost. Unfortunately boost puts the version number into the
  55. # actual filename for the libraries, so this variable will certainly be needed
  56. # in the future when new Boost versions are released.
  57. #
  58. # Currently this module searches for the following version numbers:
  59. # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
  60. # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0
  61. #
  62. # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
  63. # add both 1.x and 1.x.0 as shown above. Official Boost include directories
  64. # omit the 3rd version number from include paths if it is 0 although not all
  65. # binary Boost releases do so.
  66. #
  67. # SET(Boost_ADDITIONAL_VERSIONS "0.99" "0.99.0" "1.78" "1.78.0")
  68. #
  69. # ===================================== ============= ========================
  70. #
  71. # Variables used by this module, they can change the default behaviour and
  72. # need to be set before calling find_package:
  73. #
  74. # Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded
  75. # boost libraries. If not specified, defaults
  76. # to ON.
  77. #
  78. # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
  79. # boost libraries. Defaults to OFF.
  80. #
  81. # Other Variables used by this module which you may want to set.
  82. #
  83. # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
  84. # the boost include directory. Please see
  85. # the documentation above regarding this
  86. # annoying, but necessary variable :(
  87. #
  88. # Boost_DEBUG Set this to TRUE to enable debugging output
  89. # of FindBoost.cmake if you are having problems.
  90. # Please enable this before filing any bug
  91. # reports.
  92. #
  93. # Boost_COMPILER Set this to the compiler suffix used by Boost
  94. # (e.g. "-gcc43") if FindBoost has problems finding
  95. # the proper Boost installation
  96. #
  97. # These last three variables are available also as environment variables:
  98. #
  99. # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for
  100. # Boost. Set this if the module has problems finding
  101. # the proper Boost installation.
  102. #
  103. # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
  104. # module has problems finding the proper Boost installation
  105. #
  106. # BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
  107. # module has problems finding the proper Boost installation
  108. #
  109. # Variables defined by this module:
  110. #
  111. # Boost_FOUND System has Boost, this means the include dir was
  112. # found, as well as all the libraries specified in
  113. # the COMPONENTS list.
  114. #
  115. # Boost_INCLUDE_DIRS Boost include directories: not cached
  116. #
  117. # Boost_INCLUDE_DIR This is almost the same as above, but this one is
  118. # cached and may be modified by advanced users
  119. #
  120. # Boost_LIBRARIES Link to these to use the Boost libraries that you
  121. # specified: not cached
  122. #
  123. # Boost_LIBRARY_DIRS The path to where the Boost library files are.
  124. #
  125. # Boost_VERSION The version number of the boost libraries that
  126. # have been found, same as in version.hpp from Boost
  127. #
  128. # Boost_LIB_VERSION The version number in filename form as
  129. # it's appended to the library filenames
  130. #
  131. # Boost_MAJOR_VERSION major version number of boost
  132. # Boost_MINOR_VERSION minor version number of boost
  133. # Boost_SUBMINOR_VERSION subminor version number of boost
  134. #
  135. # Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call
  136. # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
  137. # to have diagnostic information about Boost's
  138. # automatic linking outputted during compilation time.
  139. #
  140. # For each component you specify in find_package(), the following (UPPER-CASE)
  141. # variables are set. You can use these variables if you would like to pick and
  142. # choose components for your targets instead of just using Boost_LIBRARIES.
  143. #
  144. # Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
  145. #
  146. # Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost
  147. # "component" (includes debug and optimized keywords
  148. # when needed).
  149. #
  150. # =====================================================================
  151. #
  152. #
  153. # Copyright (c) 2006-2008 Andreas Schneider <[email protected]>
  154. # Copyright (c) 2007 Wengo
  155. # Copyright (c) 2007 Mike Jackson
  156. # Copyright (c) 2008 Andreas Pakulat <[email protected]>
  157. #
  158. # Redistribution AND use is allowed according to the terms of the New
  159. # BSD license.
  160. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  161. #
  162. #-------------------------------------------------------------------------------
  163. # FindBoost functions & macros
  164. #
  165. ############################################
  166. #
  167. # Check the existence of the libraries.
  168. #
  169. ############################################
  170. # This macro was taken directly from the FindQt4.cmake file that is included
  171. # with the CMake distribution. This is NOT my work. All work was done by the
  172. # original authors of the FindQt4.cmake file. Only minor modifications were
  173. # made to remove references to Qt and make this file more generally applicable
  174. # And ELSE/ENDIF pairs were removed for readability.
  175. #########################################################################
  176. MACRO (_Boost_ADJUST_LIB_VARS basename)
  177. IF (Boost_INCLUDE_DIR )
  178. IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
  179. # if the generator supports configuration types then set
  180. # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
  181. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  182. SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  183. ELSE()
  184. # if there are no configuration types and CMAKE_BUILD_TYPE has no value
  185. # then just use the release libraries
  186. SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
  187. ENDIF()
  188. # FIXME: This probably should be set for both cases
  189. SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  190. ENDIF()
  191. # if only the release version was found, set the debug variable also to the release version
  192. IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
  193. SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
  194. SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
  195. SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
  196. ENDIF()
  197. # if only the debug version was found, set the release variable also to the debug version
  198. IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
  199. SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
  200. SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
  201. SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
  202. ENDIF()
  203. IF (Boost_${basename}_LIBRARY)
  204. set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
  205. # Remove superfluous "debug" / "optimized" keywords from
  206. # Boost_LIBRARY_DIRS
  207. FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY})
  208. GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH)
  209. LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
  210. ENDFOREACH()
  211. LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  212. set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
  213. SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
  214. ENDIF(Boost_${basename}_LIBRARY)
  215. ENDIF (Boost_INCLUDE_DIR )
  216. # Make variables changeble to the advanced user
  217. MARK_AS_ADVANCED(
  218. Boost_${basename}_LIBRARY
  219. Boost_${basename}_LIBRARY_RELEASE
  220. Boost_${basename}_LIBRARY_DEBUG
  221. )
  222. ENDMACRO (_Boost_ADJUST_LIB_VARS)
  223. #-------------------------------------------------------------------------------
  224. #
  225. # Runs compiler with "-dumpversion" and parses major/minor
  226. # version with a regex.
  227. #
  228. FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
  229. EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
  230. ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
  231. OUTPUT_VARIABLE _boost_COMPILER_VERSION
  232. )
  233. STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
  234. _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
  235. SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
  236. ENDFUNCTION()
  237. #
  238. # End functions/macros
  239. #
  240. #-------------------------------------------------------------------------------
  241. IF(NOT DEFINED Boost_USE_MULTITHREADED)
  242. SET(Boost_USE_MULTITHREADED TRUE)
  243. ENDIF()
  244. if(Boost_FIND_VERSION_EXACT)
  245. # The version may appear in a directory with or without the patch
  246. # level, even when the patch level is non-zero.
  247. set(_boost_TEST_VERSIONS
  248. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
  249. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  250. else(Boost_FIND_VERSION_EXACT)
  251. # The user has not requested an exact version. Among known
  252. # versions, find those that are acceptable to the user request.
  253. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
  254. "1.38.0" "1.38" "1.37.0" "1.37"
  255. "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
  256. "1.34" "1.33.1" "1.33.0" "1.33")
  257. set(_boost_TEST_VERSIONS)
  258. if(Boost_FIND_VERSION)
  259. set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  260. # Select acceptable versions.
  261. foreach(version ${_Boost_KNOWN_VERSIONS})
  262. if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
  263. # This version is high enough.
  264. list(APPEND _boost_TEST_VERSIONS "${version}")
  265. elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
  266. # This version is a short-form for the requested version with
  267. # the patch level dropped.
  268. list(APPEND _boost_TEST_VERSIONS "${version}")
  269. endif()
  270. endforeach(version)
  271. else(Boost_FIND_VERSION)
  272. # Any version is acceptable.
  273. set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
  274. endif(Boost_FIND_VERSION)
  275. endif(Boost_FIND_VERSION_EXACT)
  276. # The reason that we failed to find Boost. This will be set to a
  277. # user-friendly message when we fail to find some necessary piece of
  278. # Boost.
  279. set(Boost_ERROR_REASON)
  280. SET( _boost_IN_CACHE TRUE)
  281. IF(Boost_INCLUDE_DIR)
  282. # On versions < 1.35, remove the System library from the considered list
  283. # since it wasn't added until 1.35.
  284. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  285. math(EXPR _boost_maj "${Boost_VERSION} / 100000")
  286. math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000")
  287. if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35)
  288. list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  289. endif()
  290. endif()
  291. FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
  292. STRING(TOUPPER ${COMPONENT} COMPONENT)
  293. IF(NOT Boost_${COMPONENT}_FOUND)
  294. SET( _boost_IN_CACHE FALSE)
  295. ENDIF(NOT Boost_${COMPONENT}_FOUND)
  296. ENDFOREACH(COMPONENT)
  297. ELSE(Boost_INCLUDE_DIR)
  298. SET( _boost_IN_CACHE FALSE)
  299. ENDIF(Boost_INCLUDE_DIR)
  300. IF (_boost_IN_CACHE)
  301. # in cache already
  302. SET(Boost_FOUND TRUE)
  303. FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
  304. STRING(TOUPPER ${COMPONENT} COMPONENT)
  305. _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
  306. SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
  307. ENDFOREACH(COMPONENT)
  308. SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  309. IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
  310. MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  311. MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  312. MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  313. ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
  314. if(Boost_DEBUG)
  315. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  316. "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} "
  317. "is already in the cache. For debugging messages, please clear the cache.")
  318. endif()
  319. ELSE (_boost_IN_CACHE)
  320. # Need to search for boost
  321. if(Boost_DEBUG)
  322. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  323. "Boost not in cache")
  324. # Output some of their choices
  325. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  326. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  327. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  328. "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
  329. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  330. "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
  331. endif()
  332. IF(WIN32)
  333. # In windows, automatic linking is performed, so you do not have
  334. # to specify the libraries. If you are linking to a dynamic
  335. # runtime, then you can choose to link to either a static or a
  336. # dynamic Boost library, the default is to do a static link. You
  337. # can alter this for a specific library "whatever" by defining
  338. # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
  339. # linked dynamically. Alternatively you can force all Boost
  340. # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
  341. # This feature can be disabled for Boost library "whatever" by
  342. # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
  343. # BOOST_ALL_NO_LIB.
  344. # If you want to observe which libraries are being linked against
  345. # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
  346. # code to emit a #pragma message each time a library is selected
  347. # for linking.
  348. SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS
  349. "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
  350. ENDIF(WIN32)
  351. SET(_boost_INCLUDE_SEARCH_DIRS
  352. C:/boost/include
  353. C:/boost
  354. "$ENV{ProgramFiles}/boost"
  355. /sw/local/include
  356. )
  357. # If BOOST_ROOT was defined in the environment, use it.
  358. if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
  359. set(BOOST_ROOT $ENV{BOOST_ROOT})
  360. endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
  361. # If BOOSTROOT was defined in the environment, use it.
  362. if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
  363. set(BOOST_ROOT $ENV{BOOSTROOT})
  364. endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
  365. # If BOOST_INCLUDEDIR was defined in the environment, use it.
  366. IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
  367. set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
  368. ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
  369. # If BOOST_LIBRARYDIR was defined in the environment, use it.
  370. IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
  371. set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
  372. ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
  373. IF( BOOST_ROOT )
  374. file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
  375. ENDIF( BOOST_ROOT )
  376. if(Boost_DEBUG)
  377. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  378. "Declared as CMake or Environmental Variables:")
  379. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  380. " BOOST_ROOT = ${BOOST_ROOT}")
  381. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  382. " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
  383. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  384. " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
  385. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  386. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  387. endif()
  388. IF( BOOST_ROOT )
  389. SET(_boost_INCLUDE_SEARCH_DIRS
  390. ${BOOST_ROOT}/include
  391. ${BOOST_ROOT}
  392. ${_boost_INCLUDE_SEARCH_DIRS})
  393. ENDIF( BOOST_ROOT )
  394. IF( BOOST_INCLUDEDIR )
  395. file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
  396. SET(_boost_INCLUDE_SEARCH_DIRS
  397. ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
  398. ENDIF( BOOST_INCLUDEDIR )
  399. # ------------------------------------------------------------------------
  400. # Search for Boost include DIR
  401. # ------------------------------------------------------------------------
  402. # Try to find Boost by stepping backwards through the Boost versions
  403. # we know about.
  404. IF( NOT Boost_INCLUDE_DIR )
  405. # Build a list of path suffixes for each version.
  406. SET(_boost_PATH_SUFFIXES)
  407. FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
  408. # Add in a path suffix, based on the required version, ideally
  409. # we could read this from version.hpp, but for that to work we'd
  410. # need to know the include dir already
  411. set(_boost_BOOSTIFIED_VERSION)
  412. # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
  413. IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
  414. STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
  415. _boost_BOOSTIFIED_VERSION ${_boost_VER})
  416. ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
  417. STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
  418. _boost_BOOSTIFIED_VERSION ${_boost_VER})
  419. ENDIF()
  420. list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
  421. if(WIN32)
  422. # For BoostPro's underscores (and others?)
  423. list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
  424. endif()
  425. ENDFOREACH(_boost_VER)
  426. if(Boost_DEBUG)
  427. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  428. "Include debugging info:")
  429. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  430. " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
  431. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  432. " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
  433. endif()
  434. # Look for a standard boost header file.
  435. FIND_PATH(Boost_INCLUDE_DIR
  436. NAMES boost/config.hpp
  437. HINTS ${_boost_INCLUDE_SEARCH_DIRS}
  438. PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
  439. )
  440. ENDIF( NOT Boost_INCLUDE_DIR )
  441. # ------------------------------------------------------------------------
  442. # Extract version information from version.hpp
  443. # ------------------------------------------------------------------------
  444. IF(Boost_INCLUDE_DIR)
  445. # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
  446. # Read the whole file:
  447. #
  448. SET(BOOST_VERSION 0)
  449. SET(BOOST_LIB_VERSION "")
  450. FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
  451. if(Boost_DEBUG)
  452. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  453. "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
  454. endif()
  455. STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
  456. STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
  457. SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
  458. SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
  459. IF(NOT "${Boost_VERSION}" STREQUAL "0")
  460. MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  461. MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  462. MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  463. set(Boost_ERROR_REASON
  464. "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
  465. ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
  466. if(Boost_DEBUG)
  467. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  468. "version.hpp reveals boost "
  469. "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  470. endif()
  471. ELSE(Boost_INCLUDE_DIR)
  472. set(Boost_ERROR_REASON
  473. "${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.")
  474. ENDIF(Boost_INCLUDE_DIR)
  475. # ------------------------------------------------------------------------
  476. # Suffix initialization and compiler suffix detection.
  477. # ------------------------------------------------------------------------
  478. # Setting some more suffixes for the library
  479. SET (Boost_LIB_PREFIX "")
  480. if ( WIN32 AND Boost_USE_STATIC_LIBS )
  481. SET (Boost_LIB_PREFIX "lib")
  482. endif()
  483. if (Boost_COMPILER)
  484. set(_boost_COMPILER ${Boost_COMPILER})
  485. if(Boost_DEBUG)
  486. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  487. "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
  488. endif()
  489. else(Boost_COMPILER)
  490. # Attempt to guess the compiler suffix
  491. # NOTE: this is not perfect yet, if you experience any issues
  492. # please report them and use the Boost_COMPILER variable
  493. # to work around the problems.
  494. if (MSVC90)
  495. SET (_boost_COMPILER "-vc90")
  496. elseif (MSVC80)
  497. SET (_boost_COMPILER "-vc80")
  498. elseif (MSVC71)
  499. SET (_boost_COMPILER "-vc71")
  500. elseif (MSVC70) # Good luck!
  501. SET (_boost_COMPILER "-vc7") # yes, this is correct
  502. elseif (MSVC60) # Good luck!
  503. SET (_boost_COMPILER "-vc6") # yes, this is correct
  504. elseif (BORLAND)
  505. SET (_boost_COMPILER "-bcb")
  506. elseif("${CMAKE_CXX_COMPILER}" MATCHES "icl"
  507. OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  508. if(WIN32)
  509. set (_boost_COMPILER "-iw")
  510. else()
  511. set (_boost_COMPILER "-il")
  512. endif()
  513. elseif (MINGW)
  514. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  515. SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
  516. else()
  517. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  518. SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  519. endif()
  520. elseif (UNIX)
  521. if (CMAKE_COMPILER_IS_GNUCXX)
  522. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  523. SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
  524. else()
  525. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  526. # Determine which version of GCC we have.
  527. IF(APPLE)
  528. IF(Boost_MINOR_VERSION)
  529. IF(${Boost_MINOR_VERSION} GREATER 35)
  530. # In Boost 1.36.0 and newer, the mangled compiler name used
  531. # on Mac OS X/Darwin is "xgcc".
  532. SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
  533. ELSE(${Boost_MINOR_VERSION} GREATER 35)
  534. # In Boost <= 1.35.0, there is no mangled compiler name for
  535. # the Mac OS X/Darwin version of GCC.
  536. SET(_boost_COMPILER "")
  537. ENDIF(${Boost_MINOR_VERSION} GREATER 35)
  538. ELSE(Boost_MINOR_VERSION)
  539. # We don't know the Boost version, so assume it's
  540. # pre-1.36.0.
  541. SET(_boost_COMPILER "")
  542. ENDIF(Boost_MINOR_VERSION)
  543. ELSE()
  544. SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
  545. ENDIF()
  546. endif()
  547. endif (CMAKE_COMPILER_IS_GNUCXX)
  548. endif()
  549. if(Boost_DEBUG)
  550. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  551. "guessed _boost_COMPILER = ${_boost_COMPILER}")
  552. endif()
  553. endif(Boost_COMPILER)
  554. SET (_boost_MULTITHREADED "-mt")
  555. if( NOT Boost_USE_MULTITHREADED )
  556. set (_boost_MULTITHREADED "")
  557. endif()
  558. if(Boost_DEBUG)
  559. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  560. "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  561. endif()
  562. SET( _boost_STATIC_TAG "")
  563. set( _boost_ABI_TAG "")
  564. IF (WIN32)
  565. IF(MSVC)
  566. SET (_boost_ABI_TAG "g")
  567. ENDIF(MSVC)
  568. IF( Boost_USE_STATIC_LIBS )
  569. SET( _boost_STATIC_TAG "-s")
  570. ENDIF( Boost_USE_STATIC_LIBS )
  571. ENDIF(WIN32)
  572. SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")
  573. if(Boost_DEBUG)
  574. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  575. "_boost_STATIC_TAG = ${_boost_STATIC_TAG}")
  576. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  577. "_boost_ABI_TAG = ${_boost_ABI_TAG}")
  578. endif()
  579. # ------------------------------------------------------------------------
  580. # Begin finding boost libraries
  581. # ------------------------------------------------------------------------
  582. SET(_boost_LIBRARIES_SEARCH_DIRS
  583. C:/boost/lib
  584. C:/boost
  585. "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
  586. "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
  587. ${Boost_INCLUDE_DIR}/lib
  588. "$ENV{ProgramFiles}/boost"
  589. /sw/local/lib
  590. )
  591. IF( BOOST_ROOT )
  592. SET(_boost_LIBRARIES_SEARCH_DIRS
  593. ${BOOST_ROOT}/lib
  594. ${BOOST_ROOT}/stage/lib
  595. ${_boost_LIBRARIES_SEARCH_DIRS})
  596. ENDIF( BOOST_ROOT )
  597. IF( BOOST_LIBRARYDIR )
  598. file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
  599. SET(_boost_LIBRARIES_SEARCH_DIRS
  600. ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS})
  601. ENDIF( BOOST_LIBRARYDIR )
  602. if(Boost_DEBUG)
  603. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  604. "_boost_LIBRARIES_SEARCH_DIRS = ${_boost_LIBRARIES_SEARCH_DIRS}")
  605. endif()
  606. FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
  607. STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  608. SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
  609. SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
  610. SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
  611. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  612. IF( Boost_USE_STATIC_LIBS )
  613. SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  614. IF(WIN32)
  615. SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  616. ELSE(WIN32)
  617. SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  618. ENDIF(WIN32)
  619. ENDIF( Boost_USE_STATIC_LIBS )
  620. FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
  621. NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
  622. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
  623. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
  624. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
  625. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
  626. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}
  627. ${Boost_LIB_PREFIX}boost_${COMPONENT}
  628. HINTS ${_boost_LIBRARIES_SEARCH_DIRS}
  629. )
  630. FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
  631. NAMES ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
  632. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
  633. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
  634. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
  635. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}
  636. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}
  637. ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG}
  638. HINTS ${_boost_LIBRARIES_SEARCH_DIRS}
  639. )
  640. _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  641. IF( Boost_USE_STATIC_LIBS )
  642. SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  643. ENDIF( Boost_USE_STATIC_LIBS )
  644. ENDFOREACH(COMPONENT)
  645. # ------------------------------------------------------------------------
  646. # End finding boost libraries
  647. # ------------------------------------------------------------------------
  648. SET(Boost_INCLUDE_DIRS
  649. ${Boost_INCLUDE_DIR}
  650. )
  651. SET(Boost_FOUND FALSE)
  652. IF(Boost_INCLUDE_DIR)
  653. SET( Boost_FOUND TRUE )
  654. # Check the version of Boost against the requested version.
  655. if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  656. 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")
  657. endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  658. if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
  659. set( Boost_FOUND FALSE )
  660. set(_Boost_VERSION_AGE "old")
  661. elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
  662. if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
  663. set( Boost_FOUND FALSE )
  664. set(_Boost_VERSION_AGE "old")
  665. elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
  666. if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
  667. set( Boost_FOUND FALSE )
  668. set(_Boost_VERSION_AGE "old")
  669. endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
  670. endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
  671. endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
  672. if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
  673. # If the user requested an exact version of Boost, check
  674. # that. We already know that the Boost version we have is >= the
  675. # requested version.
  676. set(_Boost_VERSION_AGE "new")
  677. # If the user didn't specify a patchlevel, it's 0.
  678. if (NOT Boost_FIND_VERSION_PATCH)
  679. set(Boost_FIND_VERSION_PATCH 0)
  680. endif (NOT Boost_FIND_VERSION_PATCH)
  681. # We'll set Boost_FOUND true again if we have an exact version match.
  682. set(Boost_FOUND FALSE)
  683. if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
  684. if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
  685. if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
  686. set( Boost_FOUND TRUE )
  687. endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
  688. endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
  689. endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
  690. endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
  691. if(NOT Boost_FOUND)
  692. # State that we found a version of Boost that is too new or too old.
  693. set(Boost_ERROR_REASON
  694. "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  695. if (Boost_FIND_VERSION_PATCH)
  696. set(Boost_ERROR_REASON
  697. "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
  698. endif (Boost_FIND_VERSION_PATCH)
  699. if (NOT Boost_FIND_VERSION_EXACT)
  700. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
  701. endif (NOT Boost_FIND_VERSION_EXACT)
  702. set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
  703. endif (NOT Boost_FOUND)
  704. if (Boost_FOUND)
  705. set(_boost_CHECKED_COMPONENT FALSE)
  706. set(_Boost_MISSING_COMPONENTS)
  707. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  708. string(TOUPPER ${COMPONENT} COMPONENT)
  709. set(_boost_CHECKED_COMPONENT TRUE)
  710. if(NOT Boost_${COMPONENT}_FOUND)
  711. string(TOLOWER ${COMPONENT} COMPONENT)
  712. list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  713. set( Boost_FOUND FALSE)
  714. endif(NOT Boost_${COMPONENT}_FOUND)
  715. endforeach(COMPONENT)
  716. endif (Boost_FOUND)
  717. if(Boost_DEBUG)
  718. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  719. endif()
  720. if (_Boost_MISSING_COMPONENTS)
  721. # We were unable to find some libraries, so generate a sensible
  722. # error message that lists the libraries we were unable to find.
  723. set(Boost_ERROR_REASON
  724. "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
  725. foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  726. set(Boost_ERROR_REASON
  727. "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
  728. endforeach(COMPONENT)
  729. list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  730. list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  731. if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  732. set(Boost_ERROR_REASON
  733. "${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.")
  734. else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  735. set(Boost_ERROR_REASON
  736. "${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.")
  737. endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  738. endif (_Boost_MISSING_COMPONENTS)
  739. IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  740. # Compatibility Code for backwards compatibility with CMake
  741. # 2.4's FindBoost module.
  742. # Look for the boost library path.
  743. # Note that the user may not have installed any libraries
  744. # so it is quite possible the Boost_LIBRARY_PATH may not exist.
  745. SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  746. IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  747. GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  748. ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  749. IF("${_boost_LIB_DIR}" MATCHES "/include$")
  750. # Strip off the trailing "/include" in the path.
  751. GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  752. ENDIF("${_boost_LIB_DIR}" MATCHES "/include$")
  753. IF(EXISTS "${_boost_LIB_DIR}/lib")
  754. SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
  755. ELSE(EXISTS "${_boost_LIB_DIR}/lib")
  756. IF(EXISTS "${_boost_LIB_DIR}/stage/lib")
  757. SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
  758. ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib")
  759. SET(_boost_LIB_DIR "")
  760. ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib")
  761. ENDIF(EXISTS "${_boost_LIB_DIR}/lib")
  762. IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  763. SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
  764. ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  765. ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  766. ELSE(Boost_INCLUDE_DIR)
  767. SET( Boost_FOUND FALSE)
  768. ENDIF(Boost_INCLUDE_DIR)
  769. IF (Boost_FOUND)
  770. IF (NOT Boost_FIND_QUIETLY)
  771. MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  772. ENDIF(NOT Boost_FIND_QUIETLY)
  773. IF (NOT Boost_FIND_QUIETLY)
  774. MESSAGE(STATUS "Found the following Boost libraries:")
  775. ENDIF(NOT Boost_FIND_QUIETLY)
  776. FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} )
  777. STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  778. IF ( Boost_${UPPERCOMPONENT}_FOUND )
  779. IF (NOT Boost_FIND_QUIETLY)
  780. MESSAGE (STATUS " ${COMPONENT}")
  781. ENDIF(NOT Boost_FIND_QUIETLY)
  782. SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
  783. ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
  784. ENDFOREACH(COMPONENT)
  785. ELSE (Boost_FOUND)
  786. IF (Boost_FIND_REQUIRED)
  787. message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  788. ENDIF(Boost_FIND_REQUIRED)
  789. ENDIF(Boost_FOUND)
  790. # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
  791. MARK_AS_ADVANCED(Boost_INCLUDE_DIR
  792. Boost_INCLUDE_DIRS
  793. Boost_LIBRARY_DIRS
  794. )
  795. ENDIF(_boost_IN_CACHE)