FindBoost.cmake 39 KB

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