FindBoost.cmake 38 KB

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