1 # - Try to find Boost include dirs and libraries
2 # Usage of this module as follows:
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,
9 # == Using Header-Only libraries from within Boost: ==
11 # find_package( Boost 1.36.0 )
13 # include_directories(${Boost_INCLUDE_DIRS})
14 # add_executable(foo foo.cc)
18 # == Using actual libraries from within Boost: ==
20 # set(Boost_USE_STATIC_LIBS ON)
21 # set(Boost_USE_MULTITHREADED ON)
22 # set(Boost_USE_STATIC_RUNTIME OFF)
23 # find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
26 # include_directories(${Boost_INCLUDE_DIRS})
27 # add_executable(foo foo.cc)
28 # target_link_libraries(foo ${Boost_LIBRARIES})
32 # The components list needs to contain actual names of boost libraries only,
33 # such as "date_time" for "libboost_date_time". If you're using parts of
34 # Boost that contain header files only (e.g. foreach) you do not need to
37 # You should provide a minimum version number that should be used. If you provide this
38 # version number and specify the REQUIRED attribute, this module will fail if it
39 # can't find the specified or a later version. If you specify a version number this is
40 # automatically put into the considered list of version numbers and thus doesn't need
41 # to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
43 # NOTE for Visual Studio Users:
44 # Automatic linking is used on MSVC & Borland compilers by default when
45 # #including things in Boost. It's important to note that setting
46 # Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
47 # should you need this feature. Automatic linking typically uses static
48 # libraries with a few exceptions (Boost.Python is one).
50 # Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
51 # more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example
52 # above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
53 # gets set to OFF. It is suggested you avoid automatic linking since it
54 # will make your application less portable.
56 # =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
58 # OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
59 # boost version numbers that should be taken into account when searching
60 # for Boost. Unfortunately boost puts the version number into the
61 # actual filename for the libraries, so this variable will certainly be needed
62 # in the future when new Boost versions are released.
64 # Currently this module searches for the following version numbers:
65 # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
66 # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
67 # 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,
68 # 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0
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.
75 # set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
77 # ===================================== ============= ========================
79 # Variables used by this module, they can change the default behaviour and
80 # need to be set before calling find_package:
82 # Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded
83 # boost libraries. If not specified, defaults
86 # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
87 # boost libraries. Defaults to OFF.
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.
95 # Boost_NO_BOOST_CMAKE Do not do a find_package call in config mode
96 # before searching for a regular boost install.
97 # This will avoid finding boost-cmake installs.
101 # Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries
102 # linked against a static C++ standard library
103 # ('s' ABI tag). This option should be set to
104 # ON or OFF because the default behavior
105 # if not specified is platform dependent
106 # for backwards compatibility.
107 # [Since CMake 2.8.3]
109 # Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries
110 # compiled against a special debug build of
111 # Python ('y' ABI tag). Defaults to OFF.
112 # [Since CMake 2.8.3]
114 # Boost_USE_STLPORT If enabled, searches for boost libraries
115 # compiled against the STLPort standard
116 # library ('p' ABI tag). Defaults to OFF.
117 # [Since CMake 2.8.3]
119 # Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
120 # If enabled, searches for boost libraries
121 # compiled against the deprecated STLPort
122 # "native iostreams" feature ('n' ABI tag).
124 # [Since CMake 2.8.3]
126 # Other Variables used by this module which you may want to set.
128 # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
129 # the boost include directory. Please see
130 # the documentation above regarding this
131 # annoying, but necessary variable :(
133 # Boost_DEBUG Set this to TRUE to enable debugging output
134 # of FindBoost.cmake if you are having problems.
135 # Please enable this before filing any bug
138 # Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information
139 # about why it failed or how to fix the problem
140 # unless this is set to TRUE or the REQUIRED
141 # keyword is specified in find_package().
142 # [Since CMake 2.8.0]
144 # Boost_COMPILER Set this to the compiler suffix used by Boost
145 # (e.g. "-gcc43") if FindBoost has problems finding
146 # the proper Boost installation
148 # Boost_THREADAPI When building boost.thread, sometimes the name of the
149 # library contains an additional "pthread" or "win32"
150 # string known as the threadapi. This can happen when
151 # compiling against pthreads on Windows or win32 threads
152 # on Cygwin. You may specify this variable and if set
153 # when FindBoost searches for the Boost threading library
154 # it will first try to match the threadapi you specify.
155 # For Example: libboost_thread_win32-mgw45-mt-1_43.a
156 # might be found if you specified "win32" here before
157 # falling back on libboost_thread-mgw45-mt-1_43.a.
158 # [Since CMake 2.8.3]
160 # Boost_REALPATH Resolves symbolic links for discovered boost libraries
161 # to assist with packaging. For example, instead of
162 # Boost_SYSTEM_LIBRARY_RELEASE being resolved to
163 # "/usr/lib/libboost_system.so" it would be
164 # "/usr/lib/libboost_system.so.1.42.0" instead.
165 # This does not affect linking and should not be
166 # enabled unless the user needs this information.
167 # [Since CMake 2.8.3]
172 # These last three variables are available also as environment variables:
173 # Also, note they are completely UPPERCASE, except Boost_DIR.
175 # Boost_DIR or The preferred installation prefix for searching for
176 # BOOST_ROOT or BOOSTROOT Boost. Set this if the module has problems finding
177 # the proper Boost installation.
179 # Note that Boost_DIR behaves exactly as <package>_DIR
180 # variables are documented to behave in find_package's
181 # Config mode. That is, if it is set as a -D argument
182 # to CMake, it must point to the location of the
183 # BoostConfig.cmake or Boost-config.cmake file. If it
184 # is set as an environment variable, it must point to
185 # the root of the boost installation. BOOST_ROOT and
186 # BOOSTROOT, on the other hand, will point to the root
189 # To prevent falling back on the system paths, set
190 # Boost_NO_SYSTEM_PATHS to true.
192 # To avoid finding boost-cmake installations, set
193 # Boost_NO_BOOST_CMAKE to true.
195 # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
196 # module has problems finding the proper Boost installation
198 # BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
199 # module has problems finding the proper Boost installation
201 # Variables defined by this module:
203 # Boost_FOUND System has Boost, this means the include dir was
204 # found, as well as all the libraries specified in
205 # the COMPONENTS list.
207 # Boost_INCLUDE_DIRS Boost include directories: not cached
209 # Boost_INCLUDE_DIR This is almost the same as above, but this one is
210 # cached and may be modified by advanced users
212 # Boost_LIBRARIES Link to these to use the Boost libraries that you
213 # specified: not cached
215 # Boost_LIBRARY_DIRS The path to where the Boost library files are.
217 # Boost_VERSION The version number of the boost libraries that
218 # have been found, same as in version.hpp from Boost
220 # Boost_LIB_VERSION The version number in filename form as
221 # it's appended to the library filenames
223 # Boost_MAJOR_VERSION major version number of boost
224 # Boost_MINOR_VERSION minor version number of boost
225 # Boost_SUBMINOR_VERSION subminor version number of boost
227 # Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call
228 # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
229 # to have diagnostic information about Boost's
230 # automatic linking outputted during compilation time.
232 # For each component you specify in find_package(), the following (UPPER-CASE)
233 # variables are set. You can use these variables if you would like to pick and
234 # choose components for your targets instead of just using Boost_LIBRARIES.
236 # Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
238 # Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost
239 # "component" (includes debug and optimized keywords
242 #=============================================================================
243 # Copyright 2006-2009 Kitware, Inc.
244 # Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
245 # Copyright 2007 Wengo
246 # Copyright 2007 Mike Jackson
247 # Copyright 2008 Andreas Pakulat <apaku@gmx.de>
248 # Copyright 2008-2010 Philip Lowman <philip@yhbt.com>
250 # Distributed under the OSI-approved BSD License (the "License");
251 # see accompanying file Copyright.txt for details.
253 # This software is distributed WITHOUT ANY WARRANTY; without even the
254 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
255 # See the License for more information.
256 #=============================================================================
257 # (To distribute this file outside of CMake, substitute the full
258 # License text for the above reference.)
261 #-------------------------------------------------------------------------------
262 # Before we go searching, check whether boost-cmake is avaialble, unless the
263 # user specifically asked NOT to search for boost-cmake.
265 # If Boost_DIR is set, this behaves as any find_package call would. If not,
266 # it looks at BOOST_ROOT and BOOSTROOT to find Boost.
268 if (NOT Boost_NO_BOOST_CMAKE)
269 # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives,
270 # since these are more conventional for Boost.
271 if ("$ENV{Boost_DIR}" STREQUAL "")
272 if (NOT "$ENV{BOOST_ROOT}" STREQUAL "")
273 set(ENV{Boost_DIR} $ENV{BOOST_ROOT})
274 elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "")
275 set(ENV{Boost_DIR} $ENV{BOOSTROOT})
279 # Do the same find_package call but look specifically for the CMake version.
280 # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
281 # need to delegate them to this find_package call.
282 find_package(Boost QUIET NO_MODULE)
284 # If we found boost-cmake, then we're done. Print out what we found.
285 # Otherwise let the rest of the module try to find it.
287 message("Boost ${Boost_FIND_VERSION} found.")
288 if (Boost_FIND_COMPONENTS)
289 message("Found Boost components:")
290 message(" ${Boost_FIND_COMPONENTS}")
297 #-------------------------------------------------------------------------------
298 # FindBoost functions & macros
300 ############################################
302 # Check the existence of the libraries.
304 ############################################
305 # This macro was taken directly from the FindQt4.cmake file that is included
306 # with the CMake distribution. This is NOT my work. All work was done by the
307 # original authors of the FindQt4.cmake file. Only minor modifications were
308 # made to remove references to Qt and make this file more generally applicable
309 # And ELSE/ENDIF pairs were removed for readability.
310 #########################################################################
312 macro(_Boost_ADJUST_LIB_VARS basename)
313 if(Boost_INCLUDE_DIR )
314 if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
315 # if the generator supports configuration types then set
316 # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
317 if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
318 set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
320 # if there are no configuration types and CMAKE_BUILD_TYPE has no value
321 # then just use the release libraries
322 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
324 # FIXME: This probably should be set for both cases
325 set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
328 # if only the release version was found, set the debug variable also to the release version
329 if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
330 set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
331 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
332 set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
335 # if only the debug version was found, set the release variable also to the debug version
336 if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
337 set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
338 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
339 set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
342 # If the debug & release library ends up being the same, omit the keywords
343 if(${Boost_${basename}_LIBRARY_RELEASE} STREQUAL ${Boost_${basename}_LIBRARY_DEBUG})
344 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
345 set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} )
348 if(Boost_${basename}_LIBRARY)
349 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
351 # Remove superfluous "debug" / "optimized" keywords from
353 foreach(_boost_my_lib ${Boost_${basename}_LIBRARY})
354 get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH)
355 list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
357 list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
359 set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
360 set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
361 endif(Boost_${basename}_LIBRARY)
363 endif(Boost_INCLUDE_DIR )
364 # Make variables changeble to the advanced user
366 Boost_${basename}_LIBRARY
367 Boost_${basename}_LIBRARY_RELEASE
368 Boost_${basename}_LIBRARY_DEBUG
370 endmacro(_Boost_ADJUST_LIB_VARS)
372 #-------------------------------------------------------------------------------
375 # Runs compiler with "-dumpversion" and parses major/minor
376 # version with a regex.
378 function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
380 exec_program(${CMAKE_CXX_COMPILER}
381 ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
382 OUTPUT_VARIABLE _boost_COMPILER_VERSION
384 string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
385 _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
387 set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
391 # A convenience function for marking desired components
394 function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
395 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
396 string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
397 set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
402 # Take a list of libraries with "thread" in it
403 # and prepend duplicates with "thread_${Boost_THREADAPI}"
404 # at the front of the list
406 function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
407 set(_orig_libnames ${ARGN})
408 string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}")
409 set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
413 # If a library is found, replace its cache entry with its REALPATH
415 function(_Boost_SWAP_WITH_REALPATH _library _docstring)
417 get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
418 unset(${_library} CACHE)
419 set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
423 function(_Boost_CHECK_SPELLING _var)
425 string(TOUPPER ${_var} _var_UC)
426 message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.")
431 # End functions/macros
433 #-------------------------------------------------------------------------------
438 if(NOT DEFINED Boost_USE_MULTITHREADED)
439 set(Boost_USE_MULTITHREADED TRUE)
442 if(Boost_FIND_VERSION_EXACT)
443 # The version may appear in a directory with or without the patch
444 # level, even when the patch level is non-zero.
445 set(_boost_TEST_VERSIONS
446 "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
447 "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
448 else(Boost_FIND_VERSION_EXACT)
449 # The user has not requested an exact version. Among known
450 # versions, find those that are acceptable to the user request.
451 set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
452 "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
453 "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42"
454 "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"
455 "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
456 "1.34" "1.33.1" "1.33.0" "1.33")
457 set(_boost_TEST_VERSIONS)
458 if(Boost_FIND_VERSION)
459 set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
460 # Select acceptable versions.
461 foreach(version ${_Boost_KNOWN_VERSIONS})
462 if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
463 # This version is high enough.
464 list(APPEND _boost_TEST_VERSIONS "${version}")
465 elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
466 # This version is a short-form for the requested version with
467 # the patch level dropped.
468 list(APPEND _boost_TEST_VERSIONS "${version}")
471 else(Boost_FIND_VERSION)
472 # Any version is acceptable.
473 set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
474 endif(Boost_FIND_VERSION)
475 endif(Boost_FIND_VERSION_EXACT)
477 # The reason that we failed to find Boost. This will be set to a
478 # user-friendly message when we fail to find some necessary piece of
480 set(Boost_ERROR_REASON)
482 set( _boost_IN_CACHE TRUE)
483 if(Boost_INCLUDE_DIR)
485 # On versions < 1.35, remove the System library from the considered list
486 # since it wasn't added until 1.35.
487 if(Boost_VERSION AND Boost_FIND_COMPONENTS)
488 if(Boost_VERSION LESS 103500)
489 list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
493 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
494 string(TOUPPER ${COMPONENT} COMPONENT)
495 if(NOT Boost_${COMPONENT}_FOUND)
496 set( _boost_IN_CACHE FALSE)
497 endif(NOT Boost_${COMPONENT}_FOUND)
498 endforeach(COMPONENT)
499 else(Boost_INCLUDE_DIR)
500 set( _boost_IN_CACHE FALSE)
501 endif(Boost_INCLUDE_DIR)
505 set(Boost_FOUND TRUE)
506 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
507 string(TOUPPER ${COMPONENT} COMPONENT)
508 _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
509 set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
510 endforeach(COMPONENT)
511 set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
512 if(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
513 math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
514 math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
515 math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
516 endif(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
518 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
519 "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} "
520 "is already in the cache. To view debugging messages, please clear the cache.")
522 else(_boost_IN_CACHE)
523 # Need to search for boost
525 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
526 "Boost not in cache")
527 # Output some of their choices
528 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
529 "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
530 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
531 "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
532 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
533 "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
534 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
535 "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
536 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
537 "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
538 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
539 "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
543 # In windows, automatic linking is performed, so you do not have
544 # to specify the libraries. If you are linking to a dynamic
545 # runtime, then you can choose to link to either a static or a
546 # dynamic Boost library, the default is to do a static link. You
547 # can alter this for a specific library "whatever" by defining
548 # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
549 # linked dynamically. Alternatively you can force all Boost
550 # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
552 # This feature can be disabled for Boost library "whatever" by
553 # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
556 # If you want to observe which libraries are being linked against
557 # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
558 # code to emit a #pragma message each time a library is selected
560 set(Boost_LIB_DIAGNOSTIC_DEFINITIONS
561 "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
564 set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
567 "$ENV{ProgramFiles}/boost/include"
568 "$ENV{ProgramFiles}/boost"
572 _Boost_CHECK_SPELLING(Boost_ROOT)
573 _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
574 _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
576 # If BOOST_ROOT was defined in the environment, use it.
577 if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "")
578 set(BOOST_ROOT $ENV{Boost_DIR})
581 # If BOOST_ROOT was defined in the environment, use it.
582 if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
583 set(BOOST_ROOT $ENV{BOOST_ROOT})
586 # If BOOSTROOT was defined in the environment, use it.
587 if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
588 set(BOOST_ROOT $ENV{BOOSTROOT})
591 # If BOOST_INCLUDEDIR was defined in the environment, use it.
592 if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
593 set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
596 # If BOOST_LIBRARYDIR was defined in the environment, use it.
597 if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
598 set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
602 file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
606 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
607 "Declared as CMake or Environmental Variables:")
608 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
609 " BOOST_ROOT = ${BOOST_ROOT}")
610 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
611 " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
612 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
613 " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
614 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
615 "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
618 if( Boost_NO_SYSTEM_PATHS)
619 set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
621 set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM})
625 set(_boost_INCLUDE_SEARCH_DIRS
626 ${BOOST_ROOT}/include
628 ${_boost_INCLUDE_SEARCH_DIRS})
631 # prepend BOOST_INCLUDEDIR to search path if specified
632 if( BOOST_INCLUDEDIR )
633 file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
634 set(_boost_INCLUDE_SEARCH_DIRS
635 ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
636 endif( BOOST_INCLUDEDIR )
638 # ------------------------------------------------------------------------
639 # Search for Boost include DIR
640 # ------------------------------------------------------------------------
641 # Try to find Boost by stepping backwards through the Boost versions
643 if( NOT Boost_INCLUDE_DIR )
644 # Build a list of path suffixes for each version.
645 set(_boost_PATH_SUFFIXES)
646 foreach(_boost_VER ${_boost_TEST_VERSIONS})
647 # Add in a path suffix, based on the required version, ideally
648 # we could read this from version.hpp, but for that to work we'd
649 # need to know the include dir already
650 set(_boost_BOOSTIFIED_VERSION)
652 # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
653 if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
654 string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
655 _boost_BOOSTIFIED_VERSION ${_boost_VER})
656 elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
657 string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
658 _boost_BOOSTIFIED_VERSION ${_boost_VER})
661 list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
662 list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
664 endforeach(_boost_VER)
667 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
668 "Include debugging info:")
669 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
670 " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
671 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
672 " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
675 # Look for a standard boost header file.
676 find_path(Boost_INCLUDE_DIR
677 NAMES boost/config.hpp
678 HINTS ${_boost_INCLUDE_SEARCH_DIRS}
679 PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
680 ${_boost_FIND_OPTIONS}
682 endif( NOT Boost_INCLUDE_DIR )
684 # ------------------------------------------------------------------------
685 # Extract version information from version.hpp
686 # ------------------------------------------------------------------------
688 if(Boost_INCLUDE_DIR)
689 # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
690 # Read the whole file:
693 set(BOOST_LIB_VERSION "")
695 file(READ "${Boost_INCLUDE_DIR}/Headers/version.hpp" _boost_VERSION_HPP_CONTENTS)
697 file(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
700 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
701 "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
704 string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
705 string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
707 set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
708 set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
710 if(NOT "${Boost_VERSION}" STREQUAL "0")
711 math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
712 math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
713 math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
715 set(Boost_ERROR_REASON
716 "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
717 endif(NOT "${Boost_VERSION}" STREQUAL "0")
719 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
720 "version.hpp reveals boost "
721 "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
723 else(Boost_INCLUDE_DIR)
724 set(Boost_ERROR_REASON
725 "${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.")
726 endif(Boost_INCLUDE_DIR)
728 # ------------------------------------------------------------------------
729 # Suffix initialization and compiler suffix detection.
730 # ------------------------------------------------------------------------
732 # Setting some more suffixes for the library
733 set(Boost_LIB_PREFIX "")
734 if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
735 set(Boost_LIB_PREFIX "lib")
739 set(_boost_COMPILER ${Boost_COMPILER})
741 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
742 "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
745 # Attempt to guess the compiler suffix
746 # NOTE: this is not perfect yet, if you experience any issues
747 # please report them and use the Boost_COMPILER variable
748 # to work around the problems.
749 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
750 OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
751 OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
753 set (_boost_COMPILER "-iw")
755 set (_boost_COMPILER "-il")
758 set(_boost_COMPILER "-vc110")
760 set(_boost_COMPILER "-vc100")
762 set(_boost_COMPILER "-vc90")
764 set(_boost_COMPILER "-vc80")
766 set(_boost_COMPILER "-vc71")
767 elseif (MSVC70) # Good luck!
768 set(_boost_COMPILER "-vc7") # yes, this is correct
769 elseif (MSVC60) # Good luck!
770 set(_boost_COMPILER "-vc6") # yes, this is correct
772 set(_boost_COMPILER "-bcb")
773 elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
774 set(_boost_COMPILER "-sw")
776 if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
777 set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
779 _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
780 set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
783 if (CMAKE_COMPILER_IS_GNUCXX)
784 if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
785 set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
787 _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
788 # Determine which version of GCC we have.
790 if(Boost_MINOR_VERSION)
791 if(${Boost_MINOR_VERSION} GREATER 35)
792 # In Boost 1.36.0 and newer, the mangled compiler name used
793 # on Mac OS X/Darwin is "xgcc".
794 set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
795 else(${Boost_MINOR_VERSION} GREATER 35)
796 # In Boost <= 1.35.0, there is no mangled compiler name for
797 # the Mac OS X/Darwin version of GCC.
798 set(_boost_COMPILER "")
799 endif(${Boost_MINOR_VERSION} GREATER 35)
800 else(Boost_MINOR_VERSION)
801 # We don't know the Boost version, so assume it's
803 set(_boost_COMPILER "")
804 endif(Boost_MINOR_VERSION)
806 set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
809 endif (CMAKE_COMPILER_IS_GNUCXX)
812 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
813 "guessed _boost_COMPILER = ${_boost_COMPILER}")
815 endif(Boost_COMPILER)
817 set (_boost_MULTITHREADED "-mt")
818 if( NOT Boost_USE_MULTITHREADED )
819 set (_boost_MULTITHREADED "")
822 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
823 "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
826 #======================
827 # Systematically build up the Boost ABI tag
828 # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
829 set( _boost_RELEASE_ABI_TAG "-")
830 set( _boost_DEBUG_ABI_TAG "-")
831 # Key Use this library when:
832 # s linking statically to the C++ standard library and
833 # compiler runtime support libraries.
834 if(Boost_USE_STATIC_RUNTIME)
835 set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
836 set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
838 # g using debug versions of the standard and runtime
841 if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
842 OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
843 set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
846 # y using special debug build of python
847 if(Boost_USE_DEBUG_PYTHON)
848 set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
850 # d using a debug version of your code
851 set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
852 # p using the STLport standard library rather than the
853 # default one supplied with your compiler
854 if(Boost_USE_STLPORT)
855 set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
856 set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
858 # n using the STLport deprecated "native iostreams" feature
859 if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
860 set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
861 set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
865 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
866 "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
867 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
868 "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
871 # ------------------------------------------------------------------------
872 # Begin finding boost libraries
873 # ------------------------------------------------------------------------
876 set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
878 ${BOOST_ROOT}/stage/lib)
880 set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
881 ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
882 ${Boost_INCLUDE_DIR}/lib
883 ${Boost_INCLUDE_DIR}/../lib
884 ${Boost_INCLUDE_DIR}/stage/lib
886 set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
889 "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
890 "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
891 "$ENV{ProgramFiles}/boost/lib"
892 "$ENV{ProgramFiles}/boost"
895 set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
896 if( Boost_NO_SYSTEM_PATHS )
897 set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
899 list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
902 # prepend BOOST_LIBRARYDIR to search path if specified
903 if( BOOST_LIBRARYDIR )
904 file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
905 set(_boost_LIBRARY_SEARCH_DIRS
906 ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
910 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
911 "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
914 # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
915 if( Boost_USE_STATIC_LIBS )
916 set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
918 set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
920 set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
924 # We want to use the tag inline below without risking double dashes
925 if(_boost_RELEASE_ABI_TAG)
926 if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
927 set(_boost_RELEASE_ABI_TAG "")
930 if(_boost_DEBUG_ABI_TAG)
931 if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
932 set(_boost_DEBUG_ABI_TAG "")
936 # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
938 # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
939 # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
940 # We maintain this behavior since changing it could break people's builds.
941 # To disable the ambiguous behavior, the user need only
942 # set Boost_USE_STATIC_RUNTIME either ON or OFF.
943 set(_boost_STATIC_RUNTIME_WORKAROUND false)
944 if(WIN32 AND Boost_USE_STATIC_LIBS)
945 if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
946 set(_boost_STATIC_RUNTIME_WORKAROUND true)
951 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
952 string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
953 set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
954 set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
955 set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
957 set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
958 set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
961 # Find RELEASE libraries
963 set(_boost_RELEASE_NAMES
964 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
965 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
966 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
967 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
968 ${Boost_LIB_PREFIX}boost_${COMPONENT} )
969 if(_boost_STATIC_RUNTIME_WORKAROUND)
970 set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
971 list(APPEND _boost_RELEASE_NAMES
972 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
973 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
974 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
975 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
977 if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
978 _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
981 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
982 "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
984 find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
985 NAMES ${_boost_RELEASE_NAMES}
986 HINTS ${_boost_LIBRARY_SEARCH_DIRS}
987 ${_boost_FIND_OPTIONS}
988 DOC "${_boost_docstring_release}"
992 # Find DEBUG libraries
994 set(_boost_DEBUG_NAMES
995 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
996 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
997 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
998 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
999 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
1000 ${Boost_LIB_PREFIX}boost_${COMPONENT} )
1001 if(_boost_STATIC_RUNTIME_WORKAROUND)
1002 set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
1003 list(APPEND _boost_DEBUG_NAMES
1004 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
1005 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
1006 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
1007 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
1009 if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
1010 _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
1013 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1014 "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
1016 find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
1017 NAMES ${_boost_DEBUG_NAMES}
1018 HINTS ${_boost_LIBRARY_SEARCH_DIRS}
1019 ${_boost_FIND_OPTIONS}
1020 DOC "${_boost_docstring_debug}"
1024 _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
1025 _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
1028 _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
1030 endforeach(COMPONENT)
1032 # Restore the original find library ordering
1033 if( Boost_USE_STATIC_LIBS )
1034 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
1036 # ------------------------------------------------------------------------
1037 # End finding boost libraries
1038 # ------------------------------------------------------------------------
1040 set(Boost_INCLUDE_DIRS
1041 ${Boost_INCLUDE_DIR}
1044 set(Boost_FOUND FALSE)
1045 if(Boost_INCLUDE_DIR)
1046 set( Boost_FOUND TRUE )
1048 # Check the version of Boost against the requested version.
1049 if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
1050 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")
1051 endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
1052 if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
1053 set( Boost_FOUND FALSE )
1054 set(_Boost_VERSION_AGE "old")
1055 elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
1056 if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
1057 set( Boost_FOUND FALSE )
1058 set(_Boost_VERSION_AGE "old")
1059 elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
1060 if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
1061 set( Boost_FOUND FALSE )
1062 set(_Boost_VERSION_AGE "old")
1063 endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
1064 endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
1065 endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
1067 if (NOT Boost_FOUND)
1068 _Boost_MARK_COMPONENTS_FOUND(OFF)
1071 if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
1072 # If the user requested an exact version of Boost, check
1073 # that. We already know that the Boost version we have is >= the
1074 # requested version.
1075 set(_Boost_VERSION_AGE "new")
1077 # If the user didn't specify a patchlevel, it's 0.
1078 if (NOT Boost_FIND_VERSION_PATCH)
1079 set(Boost_FIND_VERSION_PATCH 0)
1080 endif (NOT Boost_FIND_VERSION_PATCH)
1082 # We'll set Boost_FOUND true again if we have an exact version match.
1083 set(Boost_FOUND FALSE)
1084 _Boost_MARK_COMPONENTS_FOUND(OFF)
1085 if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
1086 if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
1087 if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
1088 set( Boost_FOUND TRUE )
1089 _Boost_MARK_COMPONENTS_FOUND(ON)
1090 endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
1091 endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
1092 endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
1093 endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
1096 # State that we found a version of Boost that is too new or too old.
1097 set(Boost_ERROR_REASON
1098 "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
1099 if (Boost_FIND_VERSION_PATCH)
1100 set(Boost_ERROR_REASON
1101 "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
1102 endif (Boost_FIND_VERSION_PATCH)
1103 if (NOT Boost_FIND_VERSION_EXACT)
1104 set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
1105 endif (NOT Boost_FIND_VERSION_EXACT)
1106 set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
1107 endif (NOT Boost_FOUND)
1109 # Always check for missing components
1110 set(_boost_CHECKED_COMPONENT FALSE)
1111 set(_Boost_MISSING_COMPONENTS "")
1112 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
1113 string(TOUPPER ${COMPONENT} COMPONENT)
1114 set(_boost_CHECKED_COMPONENT TRUE)
1115 if(NOT Boost_${COMPONENT}_FOUND)
1116 string(TOLOWER ${COMPONENT} COMPONENT)
1117 list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
1118 set( Boost_FOUND FALSE)
1120 endforeach(COMPONENT)
1123 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
1126 if (_Boost_MISSING_COMPONENTS)
1127 # We were unable to find some libraries, so generate a sensible
1128 # error message that lists the libraries we were unable to find.
1129 set(Boost_ERROR_REASON
1130 "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
1131 foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
1132 set(Boost_ERROR_REASON
1133 "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
1134 endforeach(COMPONENT)
1136 list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
1137 list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
1138 if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
1139 set(Boost_ERROR_REASON
1140 "${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.")
1141 else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
1142 set(Boost_ERROR_REASON
1143 "${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.")
1144 endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
1145 endif (_Boost_MISSING_COMPONENTS)
1147 if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
1148 # Compatibility Code for backwards compatibility with CMake
1149 # 2.4's FindBoost module.
1151 # Look for the boost library path.
1152 # Note that the user may not have installed any libraries
1153 # so it is quite possible the Boost_LIBRARY_PATH may not exist.
1154 set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
1156 if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
1157 get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
1160 if("${_boost_LIB_DIR}" MATCHES "/include$")
1161 # Strip off the trailing "/include" in the path.
1162 get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
1165 if(EXISTS "${_boost_LIB_DIR}/lib")
1166 set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
1168 if(EXISTS "${_boost_LIB_DIR}/stage/lib")
1169 set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
1171 set(_boost_LIB_DIR "")
1175 if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
1176 set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
1179 endif( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
1181 else(Boost_INCLUDE_DIR)
1182 set( Boost_FOUND FALSE)
1183 endif(Boost_INCLUDE_DIR)
1186 if(NOT Boost_FIND_QUIETLY)
1187 message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
1188 if(Boost_FIND_COMPONENTS)
1189 message(STATUS "Found the following Boost libraries:")
1191 endif(NOT Boost_FIND_QUIETLY)
1192 foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
1193 string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
1194 if( Boost_${UPPERCOMPONENT}_FOUND )
1195 if(NOT Boost_FIND_QUIETLY)
1196 message (STATUS " ${COMPONENT}")
1197 endif(NOT Boost_FIND_QUIETLY)
1198 set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
1199 endif( Boost_${UPPERCOMPONENT}_FOUND )
1200 endforeach(COMPONENT)
1202 if(Boost_FIND_REQUIRED)
1203 message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
1205 if(NOT Boost_FIND_QUIETLY)
1206 # we opt not to automatically output Boost_ERROR_REASON here as
1207 # it could be quite lengthy and somewhat imposing in it's requests
1208 # Since Boost is not always a required dependency we'll leave this
1209 # up to the end-user.
1210 if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
1211 message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
1213 message(STATUS "Could NOT find Boost")
1216 endif(Boost_FIND_REQUIRED)
1219 # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
1220 mark_as_advanced(Boost_INCLUDE_DIR
1224 endif(_boost_IN_CACHE)