FindBoost.cmake 36 KB

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