FindBoost.cmake 38 KB

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