FindBoost.cmake 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154
  1. # - Try to find Boost include dirs and libraries
  2. # Usage of this module as follows:
  3. #
  4. # NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below.
  5. # Due to Boost naming conventions and limitations in CMake this find
  6. # module is NOT future safe with respect to Boost version numbers,
  7. # and may break.
  8. #
  9. # == Using Header-Only libraries from within Boost: ==
  10. #
  11. # find_package( Boost 1.36.0 )
  12. # if(Boost_FOUND)
  13. # include_directories(${Boost_INCLUDE_DIRS})
  14. # add_executable(foo foo.cc)
  15. # endif()
  16. #
  17. #
  18. # == Using actual libraries from within Boost: ==
  19. #
  20. # set(Boost_USE_STATIC_LIBS ON)
  21. # set(Boost_USE_MULTITHREADED ON)
  22. # set(Boost_USE_STATIC_RUNTIME OFF)
  23. # set(Boost_COMPAT_STATIC_RUNTIME OFF)
  24. # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
  25. #
  26. # if(Boost_FOUND)
  27. # include_directories(${Boost_INCLUDE_DIRS})
  28. # add_executable(foo foo.cc)
  29. # target_link_libraries(foo ${Boost_LIBRARIES})
  30. # endif()
  31. #
  32. #
  33. # The components list needs to contain actual names of boost libraries only,
  34. # such as "date_time" for "libboost_date_time". If you're using parts of
  35. # Boost that contain header files only (e.g. foreach) you do not need to
  36. # specify COMPONENTS.
  37. #
  38. # You should provide a minimum version number that should be used. If you provide this
  39. # version number and specify the REQUIRED attribute, this module will fail if it
  40. # can't find the specified or a later version. If you specify a version number this is
  41. # automatically put into the considered list of version numbers and thus doesn't need
  42. # to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
  43. #
  44. # NOTE for Visual Studio Users:
  45. # Automatic linking is used on MSVC & Borland compilers by default when
  46. # #including things in Boost. It's important to note that setting
  47. # Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
  48. # should you need this feature. Automatic linking typically uses static
  49. # libraries with a few exceptions (Boost.Python is one).
  50. #
  51. # Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
  52. # more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example
  53. # above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
  54. # gets set to OFF. It is suggested you avoid automatic linking since it
  55. # will make your application less portable.
  56. #
  57. # =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
  58. #
  59. # OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
  60. # boost version numbers that should be taken into account when searching
  61. # for Boost. Unfortunately boost puts the version number into the
  62. # actual filename for the libraries, so this variable will certainly be needed
  63. # in the future when new Boost versions are released.
  64. #
  65. # Currently this module searches for the following version numbers:
  66. # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
  67. # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
  68. # 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0
  69. #
  70. # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
  71. # add both 1.x and 1.x.0 as shown above. Official Boost include directories
  72. # omit the 3rd version number from include paths if it is 0 although not all
  73. # binary Boost releases do so.
  74. #
  75. # SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
  76. #
  77. # ===================================== ============= ========================
  78. #
  79. # Variables used by this module, they can change the default behaviour and
  80. # need to be set before calling find_package:
  81. #
  82. # Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded
  83. # boost libraries. If not specified, defaults
  84. # to ON.
  85. #
  86. # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
  87. # boost libraries. Defaults to OFF.
  88. #
  89. # Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system
  90. # paths (or other locations outside of BOOST_ROOT
  91. # or BOOST_INCLUDEDIR). Useful when specifying
  92. # BOOST_ROOT. Defaults to OFF.
  93. # [Since CMake 2.8.3]
  94. #
  95. # Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries
  96. # linked against a static C++ standard library
  97. # ('s' ABI tag). Defaults to OFF.
  98. # [Since CMake 2.8.3]
  99. #
  100. # Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries
  101. # compiled against a special debug build of
  102. # Python ('y' ABI tag). Defaults to OFF.
  103. # [Since CMake 2.8.3]
  104. #
  105. # Boost_USE_STLPORT If enabled, searches for boost libraries
  106. # compiled against the STLPort standard
  107. # library ('p' ABI tag). Defaults to OFF.
  108. # [Since CMake 2.8.3]
  109. #
  110. # Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  111. # If enabled, searches for boost libraries
  112. # compiled against the deprecated STLPort
  113. # "native iostreams" feature ('n' ABI tag).
  114. # Defaults to OFF.
  115. # [Since CMake 2.8.3]
  116. #
  117. # Boost_COMPAT_STATIC_RUNTIME Set to OFF to disable backwards compatible
  118. # searching for libraries with the 's' ABI
  119. # tag on WIN32 after normal searches. You
  120. # should set this to OFF and also set
  121. # Boost_USE_STATIC_RUNTIME appropriately.
  122. # If not specified, defaults to ON.
  123. # [Since CMake 2.8.3]
  124. #
  125. # Other Variables used by this module which you may want to set.
  126. #
  127. # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
  128. # the boost include directory. Please see
  129. # the documentation above regarding this
  130. # annoying, but necessary variable :(
  131. #
  132. # Boost_DEBUG Set this to TRUE to enable debugging output
  133. # of FindBoost.cmake if you are having problems.
  134. # Please enable this before filing any bug
  135. # reports.
  136. #
  137. # Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information
  138. # about why it failed or how to fix the problem
  139. # unless this is set to TRUE or the REQUIRED
  140. # keyword is specified in find_package().
  141. # [Since CMake 2.8.0]
  142. #
  143. # Boost_COMPILER Set this to the compiler suffix used by Boost
  144. # (e.g. "-gcc43") if FindBoost has problems finding
  145. # the proper Boost installation
  146. #
  147. # Boost_THREADAPI When building boost.thread, sometimes the name of the
  148. # library contains an additional "pthread" or "win32"
  149. # string known as the threadapi. This can happen when
  150. # compiling against pthreads on Windows or win32 threads
  151. # on Cygwin. You may specify this variable and if set
  152. # when FindBoost searches for the Boost threading library
  153. # it will first try to match the threadapi you specify.
  154. # For Example: libboost_thread_win32-mgw45-mt-1_43.a
  155. # might be found if you specified "win32" here before
  156. # falling back on libboost_thread-mgw45-mt-1_43.a.
  157. # [Since CMake 2.8.3]
  158. #
  159. # Boost_REALPATH Resolves symbolic links for discovered boost libraries
  160. # to assist with packaging. For example, instead of
  161. # Boost_SYSTEM_LIBRARY_RELEASE being resolved to
  162. # "/usr/lib/libboost_system.so" it would be
  163. # "/usr/lib/libboost_system.so.1.42.0" instead.
  164. # This does not affect linking and should not be
  165. # enabled unless the user needs this information.
  166. # [Since CMake 2.8.3]
  167. #
  168. #
  169. # These last three variables are available also as environment variables:
  170. #
  171. # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for
  172. # Boost. Set this if the module has problems finding
  173. # the proper Boost installation. To prevent falling
  174. # back on the system paths, set Boost_NO_SYSTEM_PATHS
  175. # to true.
  176. #
  177. # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
  178. # module has problems finding the proper Boost installation
  179. #
  180. # BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
  181. # module has problems finding the proper Boost installation
  182. #
  183. # Variables defined by this module:
  184. #
  185. # Boost_FOUND System has Boost, this means the include dir was
  186. # found, as well as all the libraries specified in
  187. # the COMPONENTS list.
  188. #
  189. # Boost_INCLUDE_DIRS Boost include directories: not cached
  190. #
  191. # Boost_INCLUDE_DIR This is almost the same as above, but this one is
  192. # cached and may be modified by advanced users
  193. #
  194. # Boost_LIBRARIES Link to these to use the Boost libraries that you
  195. # specified: not cached
  196. #
  197. # Boost_LIBRARY_DIRS The path to where the Boost library files are.
  198. #
  199. # Boost_VERSION The version number of the boost libraries that
  200. # have been found, same as in version.hpp from Boost
  201. #
  202. # Boost_LIB_VERSION The version number in filename form as
  203. # it's appended to the library filenames
  204. #
  205. # Boost_MAJOR_VERSION major version number of boost
  206. # Boost_MINOR_VERSION minor version number of boost
  207. # Boost_SUBMINOR_VERSION subminor version number of boost
  208. #
  209. # Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call
  210. # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
  211. # to have diagnostic information about Boost's
  212. # automatic linking outputted during compilation time.
  213. #
  214. # For each component you specify in find_package(), the following (UPPER-CASE)
  215. # variables are set. You can use these variables if you would like to pick and
  216. # choose components for your targets instead of just using Boost_LIBRARIES.
  217. #
  218. # Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
  219. #
  220. # Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost
  221. # "component" (includes debug and optimized keywords
  222. # when needed).
  223. #=============================================================================
  224. # Copyright 2006-2009 Kitware, Inc.
  225. # Copyright 2006-2008 Andreas Schneider <[email protected]>
  226. # Copyright 2007 Wengo
  227. # Copyright 2007 Mike Jackson
  228. # Copyright 2008 Andreas Pakulat <[email protected]>
  229. # Copyright 2008-2010 Philip Lowman <[email protected]>
  230. #
  231. # Distributed under the OSI-approved BSD License (the "License");
  232. # see accompanying file Copyright.txt for details.
  233. #
  234. # This software is distributed WITHOUT ANY WARRANTY; without even the
  235. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  236. # See the License for more information.
  237. #=============================================================================
  238. # (To distribute this file outside of CMake, substitute the full
  239. # License text for the above reference.)
  240. #-------------------------------------------------------------------------------
  241. # FindBoost functions & macros
  242. #
  243. ############################################
  244. #
  245. # Check the existence of the libraries.
  246. #
  247. ############################################
  248. # This macro was taken directly from the FindQt4.cmake file that is included
  249. # with the CMake distribution. This is NOT my work. All work was done by the
  250. # original authors of the FindQt4.cmake file. Only minor modifications were
  251. # made to remove references to Qt and make this file more generally applicable
  252. # And ELSE/ENDIF pairs were removed for readability.
  253. #########################################################################
  254. MACRO (_Boost_ADJUST_LIB_VARS basename)
  255. IF (Boost_INCLUDE_DIR )
  256. IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
  257. # if the generator supports configuration types then set
  258. # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
  259. IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  260. SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  261. ELSE()
  262. # if there are no configuration types and CMAKE_BUILD_TYPE has no value
  263. # then just use the release libraries
  264. SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
  265. ENDIF()
  266. # FIXME: This probably should be set for both cases
  267. SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  268. ENDIF()
  269. # if only the release version was found, set the debug variable also to the release version
  270. IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
  271. SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
  272. SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
  273. SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
  274. ENDIF()
  275. # if only the debug version was found, set the release variable also to the debug version
  276. IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
  277. SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
  278. SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
  279. SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
  280. ENDIF()
  281. IF (Boost_${basename}_LIBRARY)
  282. set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
  283. # Remove superfluous "debug" / "optimized" keywords from
  284. # Boost_LIBRARY_DIRS
  285. FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY})
  286. GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH)
  287. LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
  288. ENDFOREACH()
  289. LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  290. set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
  291. SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
  292. ENDIF(Boost_${basename}_LIBRARY)
  293. ENDIF (Boost_INCLUDE_DIR )
  294. # Make variables changeble to the advanced user
  295. MARK_AS_ADVANCED(
  296. Boost_${basename}_LIBRARY
  297. Boost_${basename}_LIBRARY_RELEASE
  298. Boost_${basename}_LIBRARY_DEBUG
  299. )
  300. ENDMACRO (_Boost_ADJUST_LIB_VARS)
  301. #-------------------------------------------------------------------------------
  302. #
  303. # Runs compiler with "-dumpversion" and parses major/minor
  304. # version with a regex.
  305. #
  306. FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
  307. EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
  308. ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
  309. OUTPUT_VARIABLE _boost_COMPILER_VERSION
  310. )
  311. STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
  312. _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
  313. SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
  314. ENDFUNCTION()
  315. #
  316. # A convenience function for marking desired components
  317. # as found or not
  318. #
  319. function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
  320. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  321. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  322. set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
  323. endforeach()
  324. endfunction()
  325. #
  326. # Take a list of libraries with "thread" in it
  327. # and prepend duplicates with "thread_${Boost_THREADAPI}"
  328. # at the front of the list
  329. #
  330. function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
  331. set(_orig_libnames ${ARGN})
  332. string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames ${_orig_libnames})
  333. set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
  334. endfunction()
  335. #
  336. # If a library is found, replace its cache entry with its REALPATH
  337. #
  338. function(_Boost_SWAP_WITH_REALPATH _library _docstring)
  339. if(${_library})
  340. get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
  341. unset(${_library} CACHE)
  342. set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
  343. endif()
  344. endfunction()
  345. #
  346. # End functions/macros
  347. #
  348. #-------------------------------------------------------------------------------
  349. IF(NOT DEFINED Boost_USE_MULTITHREADED)
  350. SET(Boost_USE_MULTITHREADED TRUE)
  351. ENDIF()
  352. if(NOT DEFINED Boost_COMPAT_STATIC_RUNTIME)
  353. set(Boost_COMPAT_STATIC_RUNTIME TRUE)
  354. endif()
  355. if(Boost_FIND_VERSION_EXACT)
  356. # The version may appear in a directory with or without the patch
  357. # level, even when the patch level is non-zero.
  358. set(_boost_TEST_VERSIONS
  359. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
  360. "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  361. else(Boost_FIND_VERSION_EXACT)
  362. # The user has not requested an exact version. Among known
  363. # versions, find those that are acceptable to the user request.
  364. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
  365. "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42"
  366. "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37"
  367. "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
  368. "1.34" "1.33.1" "1.33.0" "1.33")
  369. set(_boost_TEST_VERSIONS)
  370. if(Boost_FIND_VERSION)
  371. set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  372. # Select acceptable versions.
  373. foreach(version ${_Boost_KNOWN_VERSIONS})
  374. if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
  375. # This version is high enough.
  376. list(APPEND _boost_TEST_VERSIONS "${version}")
  377. elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
  378. # This version is a short-form for the requested version with
  379. # the patch level dropped.
  380. list(APPEND _boost_TEST_VERSIONS "${version}")
  381. endif()
  382. endforeach(version)
  383. else(Boost_FIND_VERSION)
  384. # Any version is acceptable.
  385. set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
  386. endif(Boost_FIND_VERSION)
  387. endif(Boost_FIND_VERSION_EXACT)
  388. # The reason that we failed to find Boost. This will be set to a
  389. # user-friendly message when we fail to find some necessary piece of
  390. # Boost.
  391. set(Boost_ERROR_REASON)
  392. SET( _boost_IN_CACHE TRUE)
  393. IF(Boost_INCLUDE_DIR)
  394. # On versions < 1.35, remove the System library from the considered list
  395. # since it wasn't added until 1.35.
  396. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  397. math(EXPR _boost_maj "${Boost_VERSION} / 100000")
  398. math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000")
  399. if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35)
  400. list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  401. endif()
  402. endif()
  403. FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
  404. STRING(TOUPPER ${COMPONENT} COMPONENT)
  405. IF(NOT Boost_${COMPONENT}_FOUND)
  406. SET( _boost_IN_CACHE FALSE)
  407. ENDIF(NOT Boost_${COMPONENT}_FOUND)
  408. ENDFOREACH(COMPONENT)
  409. ELSE(Boost_INCLUDE_DIR)
  410. SET( _boost_IN_CACHE FALSE)
  411. ENDIF(Boost_INCLUDE_DIR)
  412. IF (_boost_IN_CACHE)
  413. # in cache already
  414. SET(Boost_FOUND TRUE)
  415. FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
  416. STRING(TOUPPER ${COMPONENT} COMPONENT)
  417. _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
  418. SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
  419. ENDFOREACH(COMPONENT)
  420. SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  421. IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
  422. MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  423. MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  424. MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  425. ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
  426. if(Boost_DEBUG)
  427. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  428. "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} "
  429. "is already in the cache. To view debugging messages, please clear the cache.")
  430. endif()
  431. ELSE (_boost_IN_CACHE)
  432. # Need to search for boost
  433. if(Boost_DEBUG)
  434. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  435. "Boost not in cache")
  436. # Output some of their choices
  437. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  438. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  439. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  440. "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
  441. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  442. "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
  443. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  444. "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
  445. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  446. "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
  447. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  448. "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
  449. endif()
  450. IF(WIN32)
  451. # In windows, automatic linking is performed, so you do not have
  452. # to specify the libraries. If you are linking to a dynamic
  453. # runtime, then you can choose to link to either a static or a
  454. # dynamic Boost library, the default is to do a static link. You
  455. # can alter this for a specific library "whatever" by defining
  456. # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
  457. # linked dynamically. Alternatively you can force all Boost
  458. # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
  459. # This feature can be disabled for Boost library "whatever" by
  460. # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
  461. # BOOST_ALL_NO_LIB.
  462. # If you want to observe which libraries are being linked against
  463. # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
  464. # code to emit a #pragma message each time a library is selected
  465. # for linking.
  466. SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS
  467. "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
  468. ENDIF(WIN32)
  469. set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
  470. C:/boost/include
  471. C:/boost
  472. "$ENV{ProgramFiles}/boost/include"
  473. "$ENV{ProgramFiles}/boost"
  474. /sw/local/include
  475. )
  476. # If Boost_ROOT was defined, gently correct the user
  477. if(Boost_ROOT)
  478. message("WARNING: Boost_ROOT was set which is incorrect and is being ignored. "
  479. "You need to use BOOST_ROOT instead. "
  480. "Also, we suggest setting Boost_NO_SYSTEM_PATHS.")
  481. endif()
  482. # If BOOST_ROOT was defined in the environment, use it.
  483. if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
  484. set(BOOST_ROOT $ENV{BOOST_ROOT})
  485. endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
  486. # If BOOSTROOT was defined in the environment, use it.
  487. if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
  488. set(BOOST_ROOT $ENV{BOOSTROOT})
  489. endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
  490. # If BOOST_INCLUDEDIR was defined in the environment, use it.
  491. IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
  492. set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
  493. ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
  494. # If BOOST_LIBRARYDIR was defined in the environment, use it.
  495. IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
  496. set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
  497. ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
  498. IF( BOOST_ROOT )
  499. file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
  500. ENDIF( BOOST_ROOT )
  501. if(Boost_DEBUG)
  502. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  503. "Declared as CMake or Environmental Variables:")
  504. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  505. " BOOST_ROOT = ${BOOST_ROOT}")
  506. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  507. " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
  508. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  509. " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
  510. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  511. "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  512. endif()
  513. if( Boost_NO_SYSTEM_PATHS)
  514. set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
  515. else()
  516. set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM})
  517. endif()
  518. if( BOOST_ROOT )
  519. set(_boost_INCLUDE_SEARCH_DIRS
  520. ${BOOST_ROOT}/include
  521. ${BOOST_ROOT}
  522. ${_boost_INCLUDE_SEARCH_DIRS})
  523. endif()
  524. # prepend BOOST_INCLUDEDIR to search path if specified
  525. if( BOOST_INCLUDEDIR )
  526. file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
  527. set(_boost_INCLUDE_SEARCH_DIRS
  528. ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
  529. endif( BOOST_INCLUDEDIR )
  530. # ------------------------------------------------------------------------
  531. # Search for Boost include DIR
  532. # ------------------------------------------------------------------------
  533. # Try to find Boost by stepping backwards through the Boost versions
  534. # we know about.
  535. IF( NOT Boost_INCLUDE_DIR )
  536. # Build a list of path suffixes for each version.
  537. SET(_boost_PATH_SUFFIXES)
  538. FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
  539. # Add in a path suffix, based on the required version, ideally
  540. # we could read this from version.hpp, but for that to work we'd
  541. # need to know the include dir already
  542. set(_boost_BOOSTIFIED_VERSION)
  543. # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
  544. IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
  545. STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
  546. _boost_BOOSTIFIED_VERSION ${_boost_VER})
  547. ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
  548. STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
  549. _boost_BOOSTIFIED_VERSION ${_boost_VER})
  550. ENDIF()
  551. list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
  552. list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
  553. ENDFOREACH(_boost_VER)
  554. if(Boost_DEBUG)
  555. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  556. "Include debugging info:")
  557. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  558. " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
  559. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  560. " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
  561. endif()
  562. # Look for a standard boost header file.
  563. FIND_PATH(Boost_INCLUDE_DIR
  564. NAMES boost/config.hpp
  565. HINTS ${_boost_INCLUDE_SEARCH_DIRS}
  566. PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
  567. ${_boost_FIND_OPTIONS}
  568. )
  569. ENDIF( NOT Boost_INCLUDE_DIR )
  570. # ------------------------------------------------------------------------
  571. # Extract version information from version.hpp
  572. # ------------------------------------------------------------------------
  573. IF(Boost_INCLUDE_DIR)
  574. # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
  575. # Read the whole file:
  576. #
  577. SET(BOOST_VERSION 0)
  578. SET(BOOST_LIB_VERSION "")
  579. FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
  580. if(Boost_DEBUG)
  581. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  582. "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
  583. endif()
  584. STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
  585. STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
  586. SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
  587. SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
  588. IF(NOT "${Boost_VERSION}" STREQUAL "0")
  589. MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  590. MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  591. MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  592. set(Boost_ERROR_REASON
  593. "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
  594. ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
  595. if(Boost_DEBUG)
  596. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  597. "version.hpp reveals boost "
  598. "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  599. endif()
  600. ELSE(Boost_INCLUDE_DIR)
  601. set(Boost_ERROR_REASON
  602. "${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.")
  603. ENDIF(Boost_INCLUDE_DIR)
  604. # ------------------------------------------------------------------------
  605. # Suffix initialization and compiler suffix detection.
  606. # ------------------------------------------------------------------------
  607. # Setting some more suffixes for the library
  608. SET (Boost_LIB_PREFIX "")
  609. if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
  610. SET (Boost_LIB_PREFIX "lib")
  611. endif()
  612. if (Boost_COMPILER)
  613. set(_boost_COMPILER ${Boost_COMPILER})
  614. if(Boost_DEBUG)
  615. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  616. "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
  617. endif()
  618. else(Boost_COMPILER)
  619. # Attempt to guess the compiler suffix
  620. # NOTE: this is not perfect yet, if you experience any issues
  621. # please report them and use the Boost_COMPILER variable
  622. # to work around the problems.
  623. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
  624. OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
  625. OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  626. if(WIN32)
  627. set (_boost_COMPILER "-iw")
  628. else()
  629. set (_boost_COMPILER "-il")
  630. endif()
  631. elseif (MSVC90)
  632. SET (_boost_COMPILER "-vc90")
  633. elseif (MSVC10)
  634. SET (_boost_COMPILER "-vc100")
  635. elseif (MSVC80)
  636. SET (_boost_COMPILER "-vc80")
  637. elseif (MSVC71)
  638. SET (_boost_COMPILER "-vc71")
  639. elseif (MSVC70) # Good luck!
  640. SET (_boost_COMPILER "-vc7") # yes, this is correct
  641. elseif (MSVC60) # Good luck!
  642. SET (_boost_COMPILER "-vc6") # yes, this is correct
  643. elseif (BORLAND)
  644. SET (_boost_COMPILER "-bcb")
  645. elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
  646. set(_boost_COMPILER "-sw")
  647. elseif (MINGW)
  648. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  649. SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
  650. else()
  651. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  652. SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  653. endif()
  654. elseif (UNIX)
  655. if (CMAKE_COMPILER_IS_GNUCXX)
  656. if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  657. SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
  658. else()
  659. _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  660. # Determine which version of GCC we have.
  661. IF(APPLE)
  662. IF(Boost_MINOR_VERSION)
  663. IF(${Boost_MINOR_VERSION} GREATER 35)
  664. # In Boost 1.36.0 and newer, the mangled compiler name used
  665. # on Mac OS X/Darwin is "xgcc".
  666. SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
  667. ELSE(${Boost_MINOR_VERSION} GREATER 35)
  668. # In Boost <= 1.35.0, there is no mangled compiler name for
  669. # the Mac OS X/Darwin version of GCC.
  670. SET(_boost_COMPILER "")
  671. ENDIF(${Boost_MINOR_VERSION} GREATER 35)
  672. ELSE(Boost_MINOR_VERSION)
  673. # We don't know the Boost version, so assume it's
  674. # pre-1.36.0.
  675. SET(_boost_COMPILER "")
  676. ENDIF(Boost_MINOR_VERSION)
  677. ELSE()
  678. SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
  679. ENDIF()
  680. endif()
  681. endif (CMAKE_COMPILER_IS_GNUCXX)
  682. endif()
  683. if(Boost_DEBUG)
  684. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  685. "guessed _boost_COMPILER = ${_boost_COMPILER}")
  686. endif()
  687. endif(Boost_COMPILER)
  688. set (_boost_MULTITHREADED "-mt")
  689. if( NOT Boost_USE_MULTITHREADED )
  690. set (_boost_MULTITHREADED "")
  691. endif()
  692. if(Boost_DEBUG)
  693. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  694. "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  695. endif()
  696. #======================
  697. # Systematically build up the Boost ABI tag
  698. # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
  699. set( _boost_RELEASE_ABI_TAG "-")
  700. set( _boost_DEBUG_ABI_TAG "-")
  701. # Key Use this library when:
  702. # s linking statically to the C++ standard library and
  703. # compiler runtime support libraries.
  704. if(Boost_USE_STATIC_RUNTIME)
  705. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
  706. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
  707. endif()
  708. # g using debug versions of the standard and runtime
  709. # support libraries
  710. if(WIN32)
  711. if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
  712. OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  713. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
  714. endif()
  715. endif()
  716. # y using special debug build of python
  717. if(Boost_USE_DEBUG_PYTHON)
  718. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
  719. endif()
  720. # d using a debug version of your code
  721. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
  722. # p using the STLport standard library rather than the
  723. # default one supplied with your compiler
  724. if(Boost_USE_STLPORT)
  725. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
  726. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
  727. endif()
  728. # n using the STLport deprecated "native iostreams" feature
  729. if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
  730. set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
  731. set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
  732. endif()
  733. if(Boost_DEBUG)
  734. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  735. "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
  736. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  737. "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
  738. endif()
  739. # ------------------------------------------------------------------------
  740. # Begin finding boost libraries
  741. # ------------------------------------------------------------------------
  742. if(BOOST_ROOT)
  743. set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
  744. ${BOOST_ROOT}/lib
  745. ${BOOST_ROOT}/stage/lib)
  746. endif()
  747. set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
  748. ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
  749. ${Boost_INCLUDE_DIR}/lib
  750. ${Boost_INCLUDE_DIR}/../lib
  751. ${Boost_INCLUDE_DIR}/stage/lib
  752. )
  753. set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
  754. C:/boost/lib
  755. C:/boost
  756. "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
  757. "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
  758. "$ENV{ProgramFiles}/boost/lib"
  759. "$ENV{ProgramFiles}/boost"
  760. /sw/local/lib
  761. )
  762. set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
  763. if( Boost_NO_SYSTEM_PATHS )
  764. set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
  765. else()
  766. list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
  767. endif()
  768. # prepend BOOST_LIBRARYDIR to search path if specified
  769. if( BOOST_LIBRARYDIR )
  770. file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
  771. set(_boost_LIBRARY_SEARCH_DIRS
  772. ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
  773. endif()
  774. if(Boost_DEBUG)
  775. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  776. "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
  777. endif()
  778. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  779. if( Boost_USE_STATIC_LIBS )
  780. set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  781. if(WIN32)
  782. set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  783. else()
  784. set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
  785. endif()
  786. endif()
  787. # We want to use the tag inline below without risking double dashes
  788. if(_boost_RELEASE_ABI_TAG)
  789. if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
  790. set(_boost_RELEASE_ABI_TAG "")
  791. endif()
  792. endif()
  793. if(_boost_DEBUG_ABI_TAG)
  794. if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
  795. set(_boost_DEBUG_ABI_TAG "")
  796. endif()
  797. endif()
  798. # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
  799. # on WIN32 was to:
  800. # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
  801. # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
  802. # We maintain this behavior since changing it could break people's builds.
  803. # To disable the ambiguous behavior, the user can
  804. # set Boost_COMPAT_STATIC_RUNTIME to FALSE
  805. set(_boost_STATIC_RUNTIME_WORKAROUND false)
  806. if(Boost_COMPAT_STATIC_RUNTIME AND WIN32 AND Boost_USE_STATIC_LIBS)
  807. if(NOT Boost_USE_STATIC_RUNTIME)
  808. set(_boost_STATIC_RUNTIME_WORKAROUND true)
  809. endif()
  810. endif()
  811. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  812. string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  813. set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
  814. set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
  815. set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
  816. set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
  817. set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
  818. #
  819. # Find RELEASE libraries
  820. #
  821. set(_boost_RELEASE_NAMES
  822. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  823. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  824. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  825. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  826. ${Boost_LIB_PREFIX}boost_${COMPONENT} )
  827. if(_boost_STATIC_RUNTIME_WORKAROUND)
  828. set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
  829. list(APPEND _boost_RELEASE_NAMES
  830. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  831. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
  832. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  833. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  834. endif()
  835. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  836. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
  837. endif()
  838. if(Boost_DEBUG)
  839. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  840. "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
  841. endif()
  842. find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
  843. NAMES ${_boost_RELEASE_NAMES}
  844. HINTS ${_boost_LIBRARY_SEARCH_DIRS}
  845. ${_boost_FIND_OPTIONS}
  846. DOC "${_boost_docstring_release}"
  847. )
  848. #
  849. # Find DEBUG libraries
  850. #
  851. set(_boost_DEBUG_NAMES
  852. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  853. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  854. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  855. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
  856. ${Boost_LIB_PREFIX}boost_${COMPONENT} )
  857. if(_boost_STATIC_RUNTIME_WORKAROUND)
  858. set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
  859. list(APPEND _boost_DEBUG_NAMES
  860. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  861. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
  862. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  863. ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  864. endif()
  865. if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  866. _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
  867. endif()
  868. if(Boost_DEBUG)
  869. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  870. "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
  871. endif()
  872. find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
  873. NAMES ${_boost_DEBUG_NAMES}
  874. HINTS ${_boost_LIBRARY_SEARCH_DIRS}
  875. ${_boost_FIND_OPTIONS}
  876. DOC "${_boost_docstring_debug}"
  877. )
  878. if(Boost_REALPATH)
  879. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
  880. _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
  881. endif()
  882. _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  883. endforeach(COMPONENT)
  884. # Restore the original find library ordering
  885. if( Boost_USE_STATIC_LIBS )
  886. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  887. endif()
  888. # ------------------------------------------------------------------------
  889. # End finding boost libraries
  890. # ------------------------------------------------------------------------
  891. SET(Boost_INCLUDE_DIRS
  892. ${Boost_INCLUDE_DIR}
  893. )
  894. SET(Boost_FOUND FALSE)
  895. IF(Boost_INCLUDE_DIR)
  896. SET( Boost_FOUND TRUE )
  897. # Check the version of Boost against the requested version.
  898. if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  899. 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")
  900. endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  901. if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
  902. set( Boost_FOUND FALSE )
  903. set(_Boost_VERSION_AGE "old")
  904. elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
  905. if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
  906. set( Boost_FOUND FALSE )
  907. set(_Boost_VERSION_AGE "old")
  908. elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
  909. if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
  910. set( Boost_FOUND FALSE )
  911. set(_Boost_VERSION_AGE "old")
  912. endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
  913. endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
  914. endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
  915. if (NOT Boost_FOUND)
  916. _Boost_MARK_COMPONENTS_FOUND(OFF)
  917. endif()
  918. if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
  919. # If the user requested an exact version of Boost, check
  920. # that. We already know that the Boost version we have is >= the
  921. # requested version.
  922. set(_Boost_VERSION_AGE "new")
  923. # If the user didn't specify a patchlevel, it's 0.
  924. if (NOT Boost_FIND_VERSION_PATCH)
  925. set(Boost_FIND_VERSION_PATCH 0)
  926. endif (NOT Boost_FIND_VERSION_PATCH)
  927. # We'll set Boost_FOUND true again if we have an exact version match.
  928. set(Boost_FOUND FALSE)
  929. _Boost_MARK_COMPONENTS_FOUND(OFF)
  930. if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
  931. if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
  932. if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
  933. set( Boost_FOUND TRUE )
  934. _Boost_MARK_COMPONENTS_FOUND(ON)
  935. endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
  936. endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
  937. endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
  938. endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
  939. if(NOT Boost_FOUND)
  940. # State that we found a version of Boost that is too new or too old.
  941. set(Boost_ERROR_REASON
  942. "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  943. if (Boost_FIND_VERSION_PATCH)
  944. set(Boost_ERROR_REASON
  945. "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
  946. endif (Boost_FIND_VERSION_PATCH)
  947. if (NOT Boost_FIND_VERSION_EXACT)
  948. set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
  949. endif (NOT Boost_FIND_VERSION_EXACT)
  950. set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
  951. endif (NOT Boost_FOUND)
  952. # Always check for missing components
  953. set(_boost_CHECKED_COMPONENT FALSE)
  954. set(_Boost_MISSING_COMPONENTS "")
  955. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  956. string(TOUPPER ${COMPONENT} COMPONENT)
  957. set(_boost_CHECKED_COMPONENT TRUE)
  958. if(NOT Boost_${COMPONENT}_FOUND)
  959. string(TOLOWER ${COMPONENT} COMPONENT)
  960. list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  961. set( Boost_FOUND FALSE)
  962. endif(NOT Boost_${COMPONENT}_FOUND)
  963. endforeach(COMPONENT)
  964. if(Boost_DEBUG)
  965. message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  966. endif()
  967. if (_Boost_MISSING_COMPONENTS)
  968. # We were unable to find some libraries, so generate a sensible
  969. # error message that lists the libraries we were unable to find.
  970. set(Boost_ERROR_REASON
  971. "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
  972. foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  973. set(Boost_ERROR_REASON
  974. "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
  975. endforeach(COMPONENT)
  976. list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  977. list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  978. if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  979. set(Boost_ERROR_REASON
  980. "${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.")
  981. else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  982. set(Boost_ERROR_REASON
  983. "${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.")
  984. endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  985. endif (_Boost_MISSING_COMPONENTS)
  986. IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  987. # Compatibility Code for backwards compatibility with CMake
  988. # 2.4's FindBoost module.
  989. # Look for the boost library path.
  990. # Note that the user may not have installed any libraries
  991. # so it is quite possible the Boost_LIBRARY_PATH may not exist.
  992. SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  993. IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  994. GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  995. ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  996. IF("${_boost_LIB_DIR}" MATCHES "/include$")
  997. # Strip off the trailing "/include" in the path.
  998. GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  999. ENDIF("${_boost_LIB_DIR}" MATCHES "/include$")
  1000. IF(EXISTS "${_boost_LIB_DIR}/lib")
  1001. SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
  1002. ELSE(EXISTS "${_boost_LIB_DIR}/lib")
  1003. IF(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1004. SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
  1005. ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1006. SET(_boost_LIB_DIR "")
  1007. ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1008. ENDIF(EXISTS "${_boost_LIB_DIR}/lib")
  1009. IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1010. SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
  1011. ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1012. ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  1013. ELSE(Boost_INCLUDE_DIR)
  1014. SET( Boost_FOUND FALSE)
  1015. ENDIF(Boost_INCLUDE_DIR)
  1016. IF (Boost_FOUND)
  1017. IF (NOT Boost_FIND_QUIETLY)
  1018. MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1019. if(Boost_FIND_COMPONENTS)
  1020. message(STATUS "Found the following Boost libraries:")
  1021. endif()
  1022. ENDIF(NOT Boost_FIND_QUIETLY)
  1023. FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} )
  1024. STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  1025. IF ( Boost_${UPPERCOMPONENT}_FOUND )
  1026. IF (NOT Boost_FIND_QUIETLY)
  1027. MESSAGE (STATUS " ${COMPONENT}")
  1028. ENDIF(NOT Boost_FIND_QUIETLY)
  1029. SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
  1030. ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
  1031. ENDFOREACH(COMPONENT)
  1032. else()
  1033. if(Boost_FIND_REQUIRED)
  1034. message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  1035. else()
  1036. if(NOT Boost_FIND_QUIETLY)
  1037. # we opt not to automatically output Boost_ERROR_REASON here as
  1038. # it could be quite lengthy and somewhat imposing in it's requests
  1039. # Since Boost is not always a required dependency we'll leave this
  1040. # up to the end-user.
  1041. if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
  1042. message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
  1043. else()
  1044. message(STATUS "Could NOT find Boost")
  1045. endif()
  1046. endif()
  1047. endif(Boost_FIND_REQUIRED)
  1048. endif()
  1049. # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
  1050. MARK_AS_ADVANCED(Boost_INCLUDE_DIR
  1051. Boost_INCLUDE_DIRS
  1052. Boost_LIBRARY_DIRS
  1053. )
  1054. ENDIF(_boost_IN_CACHE)