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,
69 # 1.49, 1.49.0, 1.50, 1.50.0, 1.51, 1.51.0, 1.52, 1.52.0,
70 # 1.53, 1.53.0, 1.54, 1.54.0, 1.55, 1.55.0, 1.56, 1.56.0
72 # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
73 # add both 1.x and 1.x.0 as shown above. Official Boost include directories
74 # omit the 3rd version number from include paths if it is 0 although not all
75 # binary Boost releases do so.
77 # set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
79 # ===================================== ============= ========================
81 # Variables used by this module, they can change the default behaviour and
82 # need to be set before calling find_package:
84 # Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded
85 # boost libraries. If not specified, defaults
88 # Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static
89 # boost libraries. Defaults to OFF.
91 # Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system
92 # paths (or other locations outside of BOOST_ROOT
93 # or BOOST_INCLUDEDIR). Useful when specifying
94 # BOOST_ROOT. Defaults to OFF.
97 # Boost_NO_BOOST_CMAKE Do not do a find_package call in config mode
98 # before searching for a regular boost install.
99 # This will avoid finding boost-cmake installs.
101 # [Since CMake 2.8.6]
103 # Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries
104 # linked against a static C++ standard library
105 # ('s' ABI tag). This option should be set to
106 # ON or OFF because the default behavior
107 # if not specified is platform dependent
108 # for backwards compatibility.
109 # [Since CMake 2.8.3]
111 # Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries
112 # compiled against a special debug build of
113 # Python ('y' ABI tag). Defaults to OFF.
114 # [Since CMake 2.8.3]
116 # Boost_USE_STLPORT If enabled, searches for boost libraries
117 # compiled against the STLPort standard
118 # library ('p' ABI tag). Defaults to OFF.
119 # [Since CMake 2.8.3]
121 # Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
122 # If enabled, searches for boost libraries
123 # compiled against the deprecated STLPort
124 # "native iostreams" feature ('n' ABI tag).
126 # [Since CMake 2.8.3]
128 # Other Variables used by this module which you may want to set.
130 # Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching
131 # the boost include directory. Please see
132 # the documentation above regarding this
133 # annoying, but necessary variable :(
135 # Boost_DEBUG Set this to TRUE to enable debugging output
136 # of FindBoost.cmake if you are having problems.
137 # Please enable this before filing any bug
140 # Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information
141 # about why it failed or how to fix the problem
142 # unless this is set to TRUE or the REQUIRED
143 # keyword is specified in find_package().
144 # [Since CMake 2.8.0]
146 # Boost_COMPILER Set this to the compiler suffix used by Boost
147 # (e.g. "-gcc43") if FindBoost has problems finding
148 # the proper Boost installation
150 # Boost_THREADAPI When building boost.thread, sometimes the name of the
151 # library contains an additional "pthread" or "win32"
152 # string known as the threadapi. This can happen when
153 # compiling against pthreads on Windows or win32 threads
154 # on Cygwin. You may specify this variable and if set
155 # when FindBoost searches for the Boost threading library
156 # it will first try to match the threadapi you specify.
157 # For Example: libboost_thread_win32-mgw45-mt-1_43.a
158 # might be found if you specified "win32" here before
159 # falling back on libboost_thread-mgw45-mt-1_43.a.
160 # [Since CMake 2.8.3]
162 # Boost_REALPATH Resolves symbolic links for discovered boost libraries
163 # to assist with packaging. For example, instead of
164 # Boost_SYSTEM_LIBRARY_RELEASE being resolved to
165 # "/usr/lib/libboost_system.so" it would be
166 # "/usr/lib/libboost_system.so.1.42.0" instead.
167 # This does not affect linking and should not be
168 # enabled unless the user needs this information.
169 # [Since CMake 2.8.3]
174 # These last three variables are available also as environment variables:
175 # Also, note they are completely UPPERCASE, except Boost_DIR.
177 # Boost_DIR or The preferred installation prefix for searching for
178 # BOOST_ROOT or BOOSTROOT Boost. Set this if the module has problems finding
179 # the proper Boost installation.
181 # Note that Boost_DIR behaves exactly as <package>_DIR
182 # variables are documented to behave in find_package's
183 # Config mode. That is, if it is set as a -D argument
184 # to CMake, it must point to the location of the
185 # BoostConfig.cmake or Boost-config.cmake file. If it
186 # is set as an environment variable, it must point to
187 # the root of the boost installation. BOOST_ROOT and
188 # BOOSTROOT, on the other hand, will point to the root
191 # To prevent falling back on the system paths, set
192 # Boost_NO_SYSTEM_PATHS to true.
194 # To avoid finding boost-cmake installations, set
195 # Boost_NO_BOOST_CMAKE to true.
197 # BOOST_INCLUDEDIR Set this to the include directory of Boost, if the
198 # module has problems finding the proper Boost installation
200 # BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the
201 # module has problems finding the proper Boost installation
203 # Variables defined by this module:
205 # Boost_FOUND System has Boost, this means the include dir was
206 # found, as well as all the libraries specified in
207 # the COMPONENTS list.
209 # Boost_INCLUDE_DIRS Boost include directories: not cached
211 # Boost_INCLUDE_DIR This is almost the same as above, but this one is
212 # cached and may be modified by advanced users
214 # Boost_LIBRARIES Link to these to use the Boost libraries that you
215 # specified: not cached
217 # Boost_LIBRARY_DIRS The path to where the Boost library files are.
219 # Boost_VERSION The version number of the boost libraries that
220 # have been found, same as in version.hpp from Boost
222 # Boost_LIB_VERSION The version number in filename form as
223 # it's appended to the library filenames
225 # Boost_MAJOR_VERSION major version number of boost
226 # Boost_MINOR_VERSION minor version number of boost
227 # Boost_SUBMINOR_VERSION subminor version number of boost
229 # Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call
230 # add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
231 # to have diagnostic information about Boost's
232 # automatic linking outputted during compilation time.
234 # For each component you specify in find_package(), the following (UPPER-CASE)
235 # variables are set. You can use these variables if you would like to pick and
236 # choose components for your targets instead of just using Boost_LIBRARIES.
238 # Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found.
240 # Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost
241 # "component" (includes debug and optimized keywords
244 #=============================================================================
245 # Copyright 2006-2009 Kitware, Inc.
246 # Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
247 # Copyright 2007 Wengo
248 # Copyright 2007 Mike Jackson
249 # Copyright 2008 Andreas Pakulat <apaku@gmx.de>
250 # Copyright 2008-2012 Philip Lowman <philip@yhbt.com>
252 # Distributed under the OSI-approved BSD License (the "License");
253 # see accompanying file Copyright.txt for details.
255 # This software is distributed WITHOUT ANY WARRANTY; without even the
256 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
257 # See the License for more information.
258 #=============================================================================
259 # (To distribute this file outside of CMake, substitute the full
260 # License text for the above reference.)
263 #-------------------------------------------------------------------------------
264 # Before we go searching, check whether boost-cmake is avaialble, unless the
265 # user specifically asked NOT to search for boost-cmake.
267 # If Boost_DIR is set, this behaves as any find_package call would. If not,
268 # it looks at BOOST_ROOT and BOOSTROOT to find Boost.
270 if (NOT Boost_NO_BOOST_CMAKE)
271 # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives,
272 # since these are more conventional for Boost.
273 if ("$ENV{Boost_DIR}" STREQUAL "")
274 if (NOT "$ENV{BOOST_ROOT}" STREQUAL "")
275 set(ENV{Boost_DIR} $ENV{BOOST_ROOT})
276 elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "")
277 set(ENV{Boost_DIR} $ENV{BOOSTROOT})
281 # Do the same find_package call but look specifically for the CMake version.
282 # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
283 # need to delegate them to this find_package call.
284 find_package(Boost QUIET NO_MODULE)
286 # If we found boost-cmake, then we're done. Print out what we found.
287 # Otherwise let the rest of the module try to find it.
289 message("Boost ${Boost_FIND_VERSION} found.")
290 if (Boost_FIND_COMPONENTS)
291 message("Found Boost components:")
292 message(" ${Boost_FIND_COMPONENTS}")
299 #-------------------------------------------------------------------------------
300 # FindBoost functions & macros
303 ############################################
305 # Check the existence of the libraries.
307 ############################################
308 # This macro was taken directly from the FindQt4.cmake file that is included
309 # with the CMake distribution. This is NOT my work. All work was done by the
310 # original authors of the FindQt4.cmake file. Only minor modifications were
311 # made to remove references to Qt and make this file more generally applicable
312 # And ELSE/ENDIF pairs were removed for readability.
313 #########################################################################
315 macro(_Boost_ADJUST_LIB_VARS basename)
316 if(Boost_INCLUDE_DIR )
317 if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
318 # if the generator supports configuration types then set
319 # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
320 if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
321 set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
323 # if there are no configuration types and CMAKE_BUILD_TYPE has no value
324 # then just use the release libraries
325 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
327 # FIXME: This probably should be set for both cases
328 set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
331 # if only the release version was found, set the debug variable also to the release version
332 if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
333 set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
334 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
335 set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
338 # if only the debug version was found, set the release variable also to the debug version
339 if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
340 set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
341 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
342 set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
345 # If the debug & release library ends up being the same, omit the keywords
346 if(${Boost_${basename}_LIBRARY_RELEASE} STREQUAL ${Boost_${basename}_LIBRARY_DEBUG})
347 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
348 set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} )
351 if(Boost_${basename}_LIBRARY)
352 set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
354 # Remove superfluous "debug" / "optimized" keywords from
356 foreach(_boost_my_lib ${Boost_${basename}_LIBRARY})
357 get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH)
358 list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
360 list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
362 set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
363 set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
367 # Make variables changeble to the advanced user
369 Boost_${basename}_LIBRARY
370 Boost_${basename}_LIBRARY_RELEASE
371 Boost_${basename}_LIBRARY_DEBUG
375 #-------------------------------------------------------------------------------
378 # Runs compiler with "-dumpversion" and parses major/minor
379 # version with a regex.
381 function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
383 exec_program(${CMAKE_CXX_COMPILER}
384 ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
385 OUTPUT_VARIABLE _boost_COMPILER_VERSION
387 string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
388 _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
390 set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
394 # A convenience function for marking desired components
397 function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
398 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
399 string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
400 set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
405 # Take a list of libraries with "thread" in it
406 # and prepend duplicates with "thread_${Boost_THREADAPI}"
407 # at the front of the list
409 function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
410 set(_orig_libnames ${ARGN})
411 string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}")
412 set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
416 # If a library is found, replace its cache entry with its REALPATH
418 function(_Boost_SWAP_WITH_REALPATH _library _docstring)
420 get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
421 unset(${_library} CACHE)
422 set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
426 function(_Boost_CHECK_SPELLING _var)
428 string(TOUPPER ${_var} _var_UC)
429 message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.")
433 # Guesses Boost's compiler prefix used in built library names
434 # Returns the guess by setting the variable pointed to by _ret
435 function(_Boost_GUESS_COMPILER_PREFIX _ret)
436 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
437 OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
438 OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
440 set (_boost_COMPILER "-iw")
442 set (_boost_COMPILER "-il")
445 set(_boost_COMPILER "-vc110")
447 set(_boost_COMPILER "-vc100")
449 set(_boost_COMPILER "-vc90")
451 set(_boost_COMPILER "-vc80")
453 set(_boost_COMPILER "-vc71")
454 elseif (MSVC70) # Good luck!
455 set(_boost_COMPILER "-vc7") # yes, this is correct
456 elseif (MSVC60) # Good luck!
457 set(_boost_COMPILER "-vc6") # yes, this is correct
459 set(_boost_COMPILER "-bcb")
460 elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
461 set(_boost_COMPILER "-sw")
463 if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
464 set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
466 _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
467 set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
470 if (CMAKE_COMPILER_IS_GNUCXX)
471 if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
472 set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
474 _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
475 # Determine which version of GCC we have.
477 if(Boost_MINOR_VERSION)
478 if(${Boost_MINOR_VERSION} GREATER 35)
479 # In Boost 1.36.0 and newer, the mangled compiler name used
480 # on Mac OS X/Darwin is "xgcc".
481 set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
483 # In Boost <= 1.35.0, there is no mangled compiler name for
484 # the Mac OS X/Darwin version of GCC.
485 set(_boost_COMPILER "")
488 # We don't know the Boost version, so assume it's
490 set(_boost_COMPILER "")
493 set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
498 # TODO at least Boost_DEBUG here?
499 set(_boost_COMPILER "")
501 set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
505 # End functions/macros
507 #-------------------------------------------------------------------------------
509 #-------------------------------------------------------------------------------
511 #-------------------------------------------------------------------------------
513 if(NOT DEFINED Boost_USE_MULTITHREADED)
514 set(Boost_USE_MULTITHREADED TRUE)
517 # Check the version of Boost against the requested version.
518 if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
519 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")
522 if(Boost_FIND_VERSION_EXACT)
523 # The version may appear in a directory with or without the patch
524 # level, even when the patch level is non-zero.
525 set(_boost_TEST_VERSIONS
526 "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
527 "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
529 # The user has not requested an exact version. Among known
530 # versions, find those that are acceptable to the user request.
531 set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
532 "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54"
533 "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
534 "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
535 "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"
536 "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"
537 "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
538 "1.34" "1.33.1" "1.33.0" "1.33")
539 set(_boost_TEST_VERSIONS)
540 if(Boost_FIND_VERSION)
541 set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
542 # Select acceptable versions.
543 foreach(version ${_Boost_KNOWN_VERSIONS})
544 if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
545 # This version is high enough.
546 list(APPEND _boost_TEST_VERSIONS "${version}")
547 elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
548 # This version is a short-form for the requested version with
549 # the patch level dropped.
550 list(APPEND _boost_TEST_VERSIONS "${version}")
554 # Any version is acceptable.
555 set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
559 # The reason that we failed to find Boost. This will be set to a
560 # user-friendly message when we fail to find some necessary piece of
562 set(Boost_ERROR_REASON)
565 # Output some of their choices
566 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
567 "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
568 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
569 "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
570 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
571 "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
572 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
573 "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
574 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
575 "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
576 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
577 "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
581 # In windows, automatic linking is performed, so you do not have
582 # to specify the libraries. If you are linking to a dynamic
583 # runtime, then you can choose to link to either a static or a
584 # dynamic Boost library, the default is to do a static link. You
585 # can alter this for a specific library "whatever" by defining
586 # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
587 # linked dynamically. Alternatively you can force all Boost
588 # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
590 # This feature can be disabled for Boost library "whatever" by
591 # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
594 # If you want to observe which libraries are being linked against
595 # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
596 # code to emit a #pragma message each time a library is selected
598 set(Boost_LIB_DIAGNOSTIC_DEFINITIONS
599 "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
602 set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
605 "$ENV{ProgramFiles}/boost/include"
606 "$ENV{ProgramFiles}/boost"
610 _Boost_CHECK_SPELLING(Boost_ROOT)
611 _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
612 _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
614 # If BOOST_ROOT was defined in the environment, use it.
615 if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "")
616 set(BOOST_ROOT $ENV{Boost_DIR})
619 # If BOOST_ROOT was defined in the environment, use it.
620 if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
621 set(BOOST_ROOT $ENV{BOOST_ROOT})
624 # If BOOSTROOT was defined in the environment, use it.
625 if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
626 set(BOOST_ROOT $ENV{BOOSTROOT})
629 # If BOOST_INCLUDEDIR was defined in the environment, use it.
630 if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
631 set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
634 # If BOOST_LIBRARYDIR was defined in the environment, use it.
635 if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
636 set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
640 file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
644 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
645 "Declared as CMake or Environmental Variables:")
646 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
647 " BOOST_ROOT = ${BOOST_ROOT}")
648 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
649 " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
650 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
651 " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
652 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
653 "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
656 if( Boost_NO_SYSTEM_PATHS)
657 set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
659 set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM})
663 set(_boost_INCLUDE_SEARCH_DIRS
664 ${BOOST_ROOT}/include
666 ${_boost_INCLUDE_SEARCH_DIRS})
669 # prepend BOOST_INCLUDEDIR to search path if specified
670 if( BOOST_INCLUDEDIR )
671 file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
672 set(_boost_INCLUDE_SEARCH_DIRS
673 ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
676 # ------------------------------------------------------------------------
677 # Search for Boost include DIR
678 # ------------------------------------------------------------------------
679 # Try to find Boost by stepping backwards through the Boost versions
681 if( NOT Boost_INCLUDE_DIR )
682 # Build a list of path suffixes for each version.
683 set(_boost_PATH_SUFFIXES)
684 foreach(_boost_VER ${_boost_TEST_VERSIONS})
685 # Add in a path suffix, based on the required version, ideally
686 # we could read this from version.hpp, but for that to work we'd
687 # need to know the include dir already
688 set(_boost_BOOSTIFIED_VERSION)
690 # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
691 if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
692 string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
693 _boost_BOOSTIFIED_VERSION ${_boost_VER})
694 elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
695 string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
696 _boost_BOOSTIFIED_VERSION ${_boost_VER})
699 list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
700 list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
705 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
706 "Include debugging info:")
707 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
708 " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
709 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
710 " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
713 # Look for a standard boost header file.
714 find_path(Boost_INCLUDE_DIR
715 NAMES boost/config.hpp
716 HINTS ${_boost_INCLUDE_SEARCH_DIRS}
717 PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
718 ${_boost_FIND_OPTIONS}
722 # ------------------------------------------------------------------------
723 # Extract version information from version.hpp
724 # ------------------------------------------------------------------------
726 if(Boost_INCLUDE_DIR)
727 # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
728 # Read the whole file:
731 set(BOOST_LIB_VERSION "")
732 file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
734 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
735 "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
738 string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
739 string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
740 unset(_boost_VERSION_HPP_CONTENTS)
742 set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
743 set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
745 if(NOT "${Boost_VERSION}" STREQUAL "0")
746 math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
747 math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
748 math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
750 set(Boost_ERROR_REASON
751 "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
754 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
755 "version.hpp reveals boost "
756 "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
759 set(Boost_ERROR_REASON
760 "${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.")
763 # ------------------------------------------------------------------------
764 # Suffix initialization and compiler suffix detection.
765 # ------------------------------------------------------------------------
767 # Setting some more suffixes for the library
768 set(Boost_LIB_PREFIX "")
769 if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
770 set(Boost_LIB_PREFIX "lib")
774 set(_boost_COMPILER ${Boost_COMPILER})
776 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
777 "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
780 # Attempt to guess the compiler suffix
781 # NOTE: this is not perfect yet, if you experience any issues
782 # please report them and use the Boost_COMPILER variable
783 # to work around the problems.
784 _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
786 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
787 "guessed _boost_COMPILER = ${_boost_COMPILER}")
791 set (_boost_MULTITHREADED "-mt")
792 if( NOT Boost_USE_MULTITHREADED )
793 set (_boost_MULTITHREADED "")
796 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
797 "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
800 #======================
801 # Systematically build up the Boost ABI tag
802 # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
803 set( _boost_RELEASE_ABI_TAG "-")
804 set( _boost_DEBUG_ABI_TAG "-")
805 # Key Use this library when:
806 # s linking statically to the C++ standard library and
807 # compiler runtime support libraries.
808 if(Boost_USE_STATIC_RUNTIME)
809 set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
810 set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s")
812 # g using debug versions of the standard and runtime
815 if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
816 OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
817 set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
820 # y using special debug build of python
821 if(Boost_USE_DEBUG_PYTHON)
822 set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
824 # d using a debug version of your code
825 set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
826 # p using the STLport standard library rather than the
827 # default one supplied with your compiler
828 if(Boost_USE_STLPORT)
829 set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
830 set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p")
832 # n using the STLport deprecated "native iostreams" feature
833 if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
834 set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
835 set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n")
839 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
840 "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
841 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
842 "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
845 # ------------------------------------------------------------------------
846 # Begin finding boost libraries
847 # ------------------------------------------------------------------------
850 set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
852 ${BOOST_ROOT}/stage/lib)
854 set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
855 ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
856 ${Boost_INCLUDE_DIR}/lib
857 ${Boost_INCLUDE_DIR}/../lib
858 ${Boost_INCLUDE_DIR}/stage/lib
860 set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
863 "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
864 "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
865 "$ENV{ProgramFiles}/boost/lib"
866 "$ENV{ProgramFiles}/boost"
869 set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
870 if( Boost_NO_SYSTEM_PATHS )
871 set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
873 list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
876 # prepend BOOST_LIBRARYDIR to search path if specified
877 if( BOOST_LIBRARYDIR )
878 file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
879 set(_boost_LIBRARY_SEARCH_DIRS
880 ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
884 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
885 "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
888 # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
889 if( Boost_USE_STATIC_LIBS )
890 set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
892 set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
894 set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
898 # We want to use the tag inline below without risking double dashes
899 if(_boost_RELEASE_ABI_TAG)
900 if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
901 set(_boost_RELEASE_ABI_TAG "")
904 if(_boost_DEBUG_ABI_TAG)
905 if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
906 set(_boost_DEBUG_ABI_TAG "")
910 # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
912 # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
913 # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
914 # We maintain this behavior since changing it could break people's builds.
915 # To disable the ambiguous behavior, the user need only
916 # set Boost_USE_STATIC_RUNTIME either ON or OFF.
917 set(_boost_STATIC_RUNTIME_WORKAROUND false)
918 if(WIN32 AND Boost_USE_STATIC_LIBS)
919 if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
920 set(_boost_STATIC_RUNTIME_WORKAROUND true)
924 # On versions < 1.35, remove the System library from the considered list
925 # since it wasn't added until 1.35.
926 if(Boost_VERSION AND Boost_FIND_COMPONENTS)
927 if(Boost_VERSION LESS 103500)
928 list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
932 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
933 string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
934 set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
935 set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
936 set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
938 set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
939 set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
942 # Find RELEASE libraries
944 set(_boost_RELEASE_NAMES
945 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
946 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
947 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
948 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
949 ${Boost_LIB_PREFIX}boost_${COMPONENT} )
950 if(_boost_STATIC_RUNTIME_WORKAROUND)
951 set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
952 list(APPEND _boost_RELEASE_NAMES
953 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
954 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
955 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
956 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
958 if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
959 _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
962 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
963 "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
965 find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
966 NAMES ${_boost_RELEASE_NAMES}
967 HINTS ${_boost_LIBRARY_SEARCH_DIRS}
968 ${_boost_FIND_OPTIONS}
969 DOC "${_boost_docstring_release}"
973 # Find DEBUG libraries
975 set(_boost_DEBUG_NAMES
976 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
977 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
978 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
979 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
980 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
981 ${Boost_LIB_PREFIX}boost_${COMPONENT} )
982 if(_boost_STATIC_RUNTIME_WORKAROUND)
983 set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
984 list(APPEND _boost_DEBUG_NAMES
985 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
986 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
987 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
988 ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
990 if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
991 _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
994 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
995 "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
997 find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
998 NAMES ${_boost_DEBUG_NAMES}
999 HINTS ${_boost_LIBRARY_SEARCH_DIRS}
1000 ${_boost_FIND_OPTIONS}
1001 DOC "${_boost_docstring_debug}"
1005 _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
1006 _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" )
1009 _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
1013 # Restore the original find library ordering
1014 if( Boost_USE_STATIC_LIBS )
1015 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
1018 # ------------------------------------------------------------------------
1019 # End finding boost libraries
1020 # ------------------------------------------------------------------------
1022 # ------------------------------------------------------------------------
1023 # Begin long process of determining Boost_FOUND, starting with version
1024 # number checks, followed by
1025 # TODO: Ideally the version check logic should happen prior to searching
1027 # ------------------------------------------------------------------------
1029 set(Boost_INCLUDE_DIRS
1030 ${Boost_INCLUDE_DIR}
1033 set(Boost_FOUND FALSE)
1034 if(Boost_INCLUDE_DIR)
1035 set( Boost_FOUND TRUE )
1037 if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
1038 set( Boost_FOUND FALSE )
1039 set(_Boost_VERSION_AGE "old")
1040 elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
1041 if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
1042 set( Boost_FOUND FALSE )
1043 set(_Boost_VERSION_AGE "old")
1044 elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
1045 if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
1046 set( Boost_FOUND FALSE )
1047 set(_Boost_VERSION_AGE "old")
1052 if (NOT Boost_FOUND)
1053 _Boost_MARK_COMPONENTS_FOUND(OFF)
1056 if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
1057 # If the user requested an exact version of Boost, check
1058 # that. We already know that the Boost version we have is >= the
1059 # requested version.
1060 set(_Boost_VERSION_AGE "new")
1062 # If the user didn't specify a patchlevel, it's 0.
1063 if (NOT Boost_FIND_VERSION_PATCH)
1064 set(Boost_FIND_VERSION_PATCH 0)
1067 # We'll set Boost_FOUND true again if we have an exact version match.
1068 set(Boost_FOUND FALSE)
1069 _Boost_MARK_COMPONENTS_FOUND(OFF)
1070 if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
1071 if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
1072 if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
1073 set( Boost_FOUND TRUE )
1074 _Boost_MARK_COMPONENTS_FOUND(ON)
1081 # State that we found a version of Boost that is too new or too old.
1082 set(Boost_ERROR_REASON
1083 "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
1084 if (Boost_FIND_VERSION_PATCH)
1085 set(Boost_ERROR_REASON
1086 "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
1088 if (NOT Boost_FIND_VERSION_EXACT)
1089 set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
1091 set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
1094 # Always check for missing components
1095 set(_boost_CHECKED_COMPONENT FALSE)
1096 set(_Boost_MISSING_COMPONENTS "")
1097 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
1098 string(TOUPPER ${COMPONENT} COMPONENT)
1099 set(_boost_CHECKED_COMPONENT TRUE)
1100 if(NOT Boost_${COMPONENT}_FOUND)
1101 string(TOLOWER ${COMPONENT} COMPONENT)
1102 list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
1103 set( Boost_FOUND FALSE)
1108 message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
1111 if (_Boost_MISSING_COMPONENTS)
1112 # We were unable to find some libraries, so generate a sensible
1113 # error message that lists the libraries we were unable to find.
1114 set(Boost_ERROR_REASON
1115 "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
1116 foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
1117 set(Boost_ERROR_REASON
1118 "${Boost_ERROR_REASON} boost_${COMPONENT}\n")
1121 list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
1122 list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
1123 if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
1124 set(Boost_ERROR_REASON
1125 "${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.")
1127 set(Boost_ERROR_REASON
1128 "${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.")
1132 if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
1133 # Compatibility Code for backwards compatibility with CMake
1134 # 2.4's FindBoost module.
1136 # Look for the boost library path.
1137 # Note that the user may not have installed any libraries
1138 # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
1139 set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
1141 if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
1142 get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
1145 if("${_boost_LIB_DIR}" MATCHES "/include$")
1146 # Strip off the trailing "/include" in the path.
1147 get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
1150 if(EXISTS "${_boost_LIB_DIR}/lib")
1151 set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
1153 if(EXISTS "${_boost_LIB_DIR}/stage/lib")
1154 set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
1156 set(_boost_LIB_DIR "")
1160 if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
1161 set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
1167 set( Boost_FOUND FALSE)
1170 # ------------------------------------------------------------------------
1171 # Notification to end user about what was found
1172 # ------------------------------------------------------------------------
1175 if(NOT Boost_FIND_QUIETLY)
1176 message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
1177 if(Boost_FIND_COMPONENTS)
1178 message(STATUS "Found the following Boost libraries:")
1181 foreach( COMPONENT ${Boost_FIND_COMPONENTS} )
1182 string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
1183 if( Boost_${UPPERCOMPONENT}_FOUND )
1184 if(NOT Boost_FIND_QUIETLY)
1185 message (STATUS " ${COMPONENT}")
1187 set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
1191 if(Boost_FIND_REQUIRED)
1192 message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
1194 if(NOT Boost_FIND_QUIETLY)
1195 # we opt not to automatically output Boost_ERROR_REASON here as
1196 # it could be quite lengthy and somewhat imposing in its requests
1197 # Since Boost is not always a required dependency we'll leave this
1198 # up to the end-user.
1199 if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
1200 message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
1202 message(STATUS "Could NOT find Boost")
1208 # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
1209 mark_as_advanced(Boost_INCLUDE_DIR