Fix doc bugs in LibIberty
[dyninst.git] / cmake / Modules / FindBoost.cmake
1 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
3
4 #[=======================================================================[.rst:
5 #FindBoost
6 #---------
7 #
8 #Find Boost include dirs and libraries
9 #
10 #Use this module by invoking find_package with the form::
11 #
12 #  find_package(Boost
13 #    [version] [EXACT]      # Minimum or EXACT version e.g. 1.67.0
14 #    [REQUIRED]             # Fail with error if Boost is not found
15 #    [COMPONENTS <libs>...] # Boost libraries by their canonical name
16 #                           # e.g. "date_time" for "libboost_date_time"
17 #    [OPTIONAL_COMPONENTS <libs>...]
18 #                           # Optional Boost libraries by their canonical name)
19 #    )                      # e.g. "date_time" for "libboost_date_time"
20 #
21 #This module finds headers and requested component libraries OR a CMake
22 #package configuration file provided by a "Boost CMake" build.  For the
23 #latter case skip to the "Boost CMake" section below.  For the former
24 #case results are reported in variables::
25 #
26 #  Boost_FOUND            - True if headers and requested libraries were found
27 #  Boost_INCLUDE_DIRS     - Boost include directories
28 #  Boost_LIBRARY_DIRS     - Link directories for Boost libraries
29 #  Boost_LIBRARIES        - Boost component libraries to be linked
30 #  Boost_<C>_FOUND        - True if component <C> was found (<C> is upper-case)
31 #  Boost_<C>_LIBRARY      - Libraries to link for component <C> (may include
32 #                           target_link_libraries debug/optimized keywords)
33 #  Boost_VERSION          - BOOST_VERSION value from boost/version.hpp
34 #  Boost_LIB_VERSION      - Version string appended to library filenames
35 #  Boost_MAJOR_VERSION    - Boost major version number (X in X.y.z)
36 #  Boost_MINOR_VERSION    - Boost minor version number (Y in x.Y.z)
37 #  Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
38 #  Boost_VERSION_STRING   - Boost version number in x.y.z format
39 #  Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
40 #                         - Pass to add_definitions() to have diagnostic
41 #                           information about Boost's automatic linking
42 #                           displayed during compilation
43 #
44 #Note that Boost Python components require a Python version suffix
45 #(Boost 1.67 and later), e.g. ``python36`` or ``python27`` for the
46 #versions built against Python 3.6 and 2.7, respectively.  This also
47 #applies to additional components using Python including
48 #``mpi_python`` and ``numpy``.  Earlier Boost releases may use
49 #distribution-specific suffixes such as ``2``, ``3`` or ``2.7``.
50 #These may also be used as suffixes, but note that they are not
51 #portable.
52 #
53 #This module reads hints about search locations from variables::
54 #
55 #  BOOST_ROOT             - Preferred installation prefix
56 #   (or BOOSTROOT)
57 #  BOOST_INCLUDEDIR       - Preferred include directory e.g. <prefix>/include
58 #  BOOST_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
59 #  Boost_NO_SYSTEM_PATHS  - Set to ON to disable searching in locations not
60 #                           specified by these hint variables. Default is OFF.
61 #  Boost_ADDITIONAL_VERSIONS
62 #                         - List of Boost versions not known to this module
63 #                           (Boost install locations may contain the version)
64 #
65 #and saves search results persistently in CMake cache entries::
66 #
67 #  Boost_INCLUDE_DIR         - Directory containing Boost headers
68 #  Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
69 #  Boost_LIBRARY_DIR_DEBUG   - Directory containing debug Boost libraries
70 #  Boost_<C>_LIBRARY_DEBUG   - Component <C> library debug variant
71 #  Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
72 #
73 #The following :prop_tgt:`IMPORTED` targets are also defined::
74 #
75 #  Boost::boost                  - Target for header-only dependencies
76 #                                  (Boost include directory)
77 #  Boost::<C>                    - Target for specific component dependency
78 #                                  (shared or static library); <C> is lower-
79 #                                  case
80 #  Boost::diagnostic_definitions - interface target to enable diagnostic
81 #                                  information about Boost's automatic linking
82 #                                  during compilation (adds BOOST_LIB_DIAGNOSTIC)
83 #  Boost::disable_autolinking    - interface target to disable automatic
84 #                                  linking with MSVC (adds BOOST_ALL_NO_LIB)
85 #  Boost::dynamic_linking        - interface target to enable dynamic linking
86 #                                  linking with MSVC (adds BOOST_ALL_DYN_LINK)
87 #
88 #Implicit dependencies such as Boost::filesystem requiring
89 #Boost::system will be automatically detected and satisfied, even
90 #if system is not specified when using find_package and if
91 #Boost::system is not added to target_link_libraries.  If using
92 #Boost::thread, then Threads::Threads will also be added automatically.
93 #
94 #It is important to note that the imported targets behave differently
95 #than variables created by this module: multiple calls to
96 #find_package(Boost) in the same directory or sub-directories with
97 #different options (e.g. static or shared) will not override the
98 #values of the targets created by the first call.
99 #
100 #Users may set these hints or results as cache entries.  Projects
101 #should not read these entries directly but instead use the above
102 #result variables.  Note that some hint names start in upper-case
103 #"BOOST".  One may specify these as environment variables if they are
104 #not specified as CMake variables or cache entries.
105 #
106 #This module first searches for the Boost header files using the above
107 #hint variables (excluding BOOST_LIBRARYDIR) and saves the result in
108 #Boost_INCLUDE_DIR.  Then it searches for requested component libraries
109 #using the above hints (excluding BOOST_INCLUDEDIR and
110 #Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR,
111 #and the library name configuration settings below.  It saves the
112 #library directories in Boost_LIBRARY_DIR_DEBUG and
113 #Boost_LIBRARY_DIR_RELEASE and individual library
114 #locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE.
115 #When one changes settings used by previous searches in the same build
116 #tree (excluding environment variables) this module discards previous
117 #search results affected by the changes and searches again.
118 #
119 #Boost libraries come in many variants encoded in their file name.
120 #Users or projects may tell this module which variant to find by
121 #setting variables::
122 #
123 #  Boost_USE_DEBUG_LIBS     - Set to ON or OFF to specify whether to search
124 #                             and use the debug libraries.  Default is ON.
125 #  Boost_USE_RELEASE_LIBS   - Set to ON or OFF to specify whether to search
126 #                             and use the release libraries.  Default is ON.
127 #  Boost_USE_MULTITHREADED  - Set to OFF to use the non-multithreaded
128 #                             libraries ('mt' tag).  Default is ON.
129 #  Boost_USE_STATIC_LIBS    - Set to ON to force the use of the static
130 #                             libraries.  Default is OFF.
131 #  Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
132 #                             libraries linked statically to the C++ runtime
133 #                             ('s' tag).  Default is platform dependent.
134 #  Boost_USE_DEBUG_RUNTIME  - Set to ON or OFF to specify whether to use
135 #                             libraries linked to the MS debug C++ runtime
136 #                             ('g' tag).  Default is ON.
137 #  Boost_USE_DEBUG_PYTHON   - Set to ON to use libraries compiled with a
138 #                             debug Python build ('y' tag). Default is OFF.
139 #  Boost_USE_STLPORT        - Set to ON to use libraries compiled with
140 #                             STLPort ('p' tag).  Default is OFF.
141 #  Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
142 #                           - Set to ON to use libraries compiled with
143 #                             STLPort deprecated "native iostreams"
144 #                             ('n' tag).  Default is OFF.
145 #  Boost_COMPILER           - Set to the compiler-specific library suffix
146 #                             (e.g. "-gcc43").  Default is auto-computed
147 #                             for the C++ compiler in use.  A list may be
148 #                             used if multiple compatible suffixes should
149 #                             be tested for, in decreasing order of
150 #                             preference.
151 #  Boost_ARCHITECTURE       - Set to the architecture-specific library suffix
152 #                             (e.g. "-x64").  Default is auto-computed for the
153 #                             C++ compiler in use.
154 #  Boost_THREADAPI          - Suffix for "thread" component library name,
155 #                             such as "pthread" or "win32".  Names with
156 #                             and without this suffix will both be tried.
157 #  Boost_NAMESPACE          - Alternate namespace used to build boost with
158 #                             e.g. if set to "myboost", will search for
159 #                             myboost_thread instead of boost_thread.
160 #
161 #Other variables one may set to control this module are::
162 #
163 #  Boost_DEBUG              - Set to ON to enable debug output from FindBoost.
164 #                             Please enable this before filing any bug report.
165 #  Boost_DETAILED_FAILURE_MSG
166 #                           - Set to ON to add detailed information to the
167 #                             failure message even when the REQUIRED option
168 #                             is not given to the find_package call.
169 #  Boost_REALPATH           - Set to ON to resolve symlinks for discovered
170 #                             libraries to assist with packaging.  For example,
171 #                             the "system" component library may be resolved to
172 #                             "/usr/lib/libboost_system.so.1.67.0" instead of
173 #                             "/usr/lib/libboost_system.so".  This does not
174 #                             affect linking and should not be enabled unless
175 #                             the user needs this information.
176 #  Boost_LIBRARY_DIR        - Default value for Boost_LIBRARY_DIR_RELEASE and
177 #                             Boost_LIBRARY_DIR_DEBUG.
178 #
179 #On Visual Studio and Borland compilers Boost headers request automatic
180 #linking to corresponding libraries.  This requires matching libraries
181 #to be linked explicitly or available in the link library search path.
182 #In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve
183 #dynamic linking.  Boost automatic linking typically requests static
184 #libraries with a few exceptions (such as Boost.Python).  Use::
185 #
186 #  add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
187 #
188 #to ask Boost to report information about automatic linking requests.
189 #
190 #Example to find Boost headers only::
191 #
192 #  find_package(Boost 1.36.0)
193 #  if(Boost_FOUND)
194 #    include_directories(${Boost_INCLUDE_DIRS})
195 #    add_executable(foo foo.cc)
196 #  endif()
197 #
198 #Example to find Boost libraries and use imported targets::
199 #
200 #  find_package(Boost 1.56 REQUIRED COMPONENTS
201 #               date_time filesystem iostreams)
202 #  add_executable(foo foo.cc)
203 #  target_link_libraries(foo Boost::date_time Boost::filesystem
204 #                            Boost::iostreams)
205 #
206 #Example to find Boost Python 3.6 libraries and use imported targets::
207 #
208 #  find_package(Boost 1.67 REQUIRED COMPONENTS
209 #               python36 numpy36)
210 #  add_executable(foo foo.cc)
211 #  target_link_libraries(foo Boost::python36 Boost::numpy36)
212 #
213 #Example to find Boost headers and some *static* (release only) libraries::
214 #
215 #  set(Boost_USE_STATIC_LIBS        ON)  # only find static libs
216 #  set(Boost_USE_DEBUG_LIBS         OFF) # ignore debug libs and
217 #  set(Boost_USE_RELEASE_LIBS       ON)  # only find release libs
218 #  set(Boost_USE_MULTITHREADED      ON)
219 #  set(Boost_USE_STATIC_RUNTIME    OFF)
220 #  find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...)
221 #  if(Boost_FOUND)
222 #    include_directories(${Boost_INCLUDE_DIRS})
223 #    add_executable(foo foo.cc)
224 #    target_link_libraries(foo ${Boost_LIBRARIES})
225 #  endif()
226 #
227 #Boost CMake
228 #^^^^^^^^^^^
229 #
230 #If Boost was built using the boost-cmake project it provides a package
231 #configuration file for use with find_package's Config mode.  This
232 #module looks for the package configuration file called
233 #BoostConfig.cmake or boost-config.cmake and stores the result in cache
234 #entry "Boost_DIR".  If found, the package configuration file is loaded
235 #and this module returns with no further action.  See documentation of
236 #the Boost CMake package configuration for details on what it provides.
237 #
238 #Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
239 #]=======================================================================]
240
241 # Save project's policies
242 cmake_policy(PUSH)
243 cmake_policy(SET CMP0057 NEW) # if IN_LIST
244
245 #-------------------------------------------------------------------------------
246 # Before we go searching, check whether boost-cmake is available, unless the
247 # user specifically asked NOT to search for boost-cmake.
248 #
249 # If Boost_DIR is set, this behaves as any find_package call would. If not,
250 # it looks at BOOST_ROOT and BOOSTROOT to find Boost.
251 #
252 if (NOT Boost_NO_BOOST_CMAKE)
253   # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives,
254   # since these are more conventional for Boost.
255   if ("$ENV{Boost_DIR}" STREQUAL "")
256     if (NOT "$ENV{BOOST_ROOT}" STREQUAL "")
257       set(ENV{Boost_DIR} $ENV{BOOST_ROOT})
258     elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "")
259       set(ENV{Boost_DIR} $ENV{BOOSTROOT})
260     endif()
261   endif()
262
263   # Do the same find_package call but look specifically for the CMake version.
264   # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
265   # need to delegate them to this find_package call.
266   find_package(Boost QUIET NO_MODULE)
267   mark_as_advanced(Boost_DIR)
268
269   # If we found boost-cmake, then we're done.  Print out what we found.
270   # Otherwise let the rest of the module try to find it.
271   if (Boost_FOUND)
272     message(STATUS "Boost ${Boost_FIND_VERSION} found.")
273     if (Boost_FIND_COMPONENTS)
274       message(STATUS "Found Boost components:\n   ${Boost_FIND_COMPONENTS}")
275     endif()
276     # Restore project's policies
277     cmake_policy(POP)
278     return()
279   endif()
280 endif()
281
282
283 #-------------------------------------------------------------------------------
284 #  FindBoost functions & macros
285 #
286
287 ############################################
288 #
289 # Check the existence of the libraries.
290 #
291 ############################################
292 # This macro was taken directly from the FindQt4.cmake file that is included
293 # with the CMake distribution. This is NOT my work. All work was done by the
294 # original authors of the FindQt4.cmake file. Only minor modifications were
295 # made to remove references to Qt and make this file more generally applicable
296 # And ELSE/ENDIF pairs were removed for readability.
297 #########################################################################
298
299 macro(_Boost_ADJUST_LIB_VARS basename)
300   if(Boost_INCLUDE_DIR )
301     if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
302       # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
303       # single-config generators, set optimized and debug libraries
304       get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
305       if(_isMultiConfig OR CMAKE_BUILD_TYPE)
306         set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
307       else()
308         # For single-config generators where CMAKE_BUILD_TYPE has no value,
309         # just use the release libraries
310         set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
311       endif()
312       # FIXME: This probably should be set for both cases
313       set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
314     endif()
315
316     # if only the release version was found, set the debug variable also to the release version
317     if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
318       set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
319       set(Boost_${basename}_LIBRARY       ${Boost_${basename}_LIBRARY_RELEASE})
320       set(Boost_${basename}_LIBRARIES     ${Boost_${basename}_LIBRARY_RELEASE})
321     endif()
322
323     # if only the debug version was found, set the release variable also to the debug version
324     if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
325       set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
326       set(Boost_${basename}_LIBRARY         ${Boost_${basename}_LIBRARY_DEBUG})
327       set(Boost_${basename}_LIBRARIES       ${Boost_${basename}_LIBRARY_DEBUG})
328     endif()
329
330     # If the debug & release library ends up being the same, omit the keywords
331     if("${Boost_${basename}_LIBRARY_RELEASE}" STREQUAL "${Boost_${basename}_LIBRARY_DEBUG}")
332       set(Boost_${basename}_LIBRARY   ${Boost_${basename}_LIBRARY_RELEASE} )
333       set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} )
334     endif()
335
336     if(Boost_${basename}_LIBRARY AND Boost_${basename}_HEADER)
337       set(Boost_${basename}_FOUND ON)
338       if("x${basename}" STREQUAL "xTHREAD" AND NOT TARGET Threads::Threads)
339         string(APPEND Boost_ERROR_REASON_THREAD " (missing dependency: Threads)")
340         set(Boost_THREAD_FOUND OFF)
341       endif()
342     endif()
343
344   endif()
345   # Make variables changeable to the advanced user
346   mark_as_advanced(
347       Boost_${basename}_LIBRARY_RELEASE
348       Boost_${basename}_LIBRARY_DEBUG
349   )
350 endmacro()
351
352 # Detect changes in used variables.
353 # Compares the current variable value with the last one.
354 # In short form:
355 # v != v_LAST                      -> CHANGED = 1
356 # v is defined, v_LAST not         -> CHANGED = 1
357 # v is not defined, but v_LAST is  -> CHANGED = 1
358 # otherwise                        -> CHANGED = 0
359 # CHANGED is returned in variable named ${changed_var}
360 macro(_Boost_CHANGE_DETECT changed_var)
361   set(${changed_var} 0)
362   foreach(v ${ARGN})
363     if(DEFINED _Boost_COMPONENTS_SEARCHED)
364       if(${v})
365         if(_${v}_LAST)
366           string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED)
367         else()
368           set(_${v}_CHANGED 1)
369         endif()
370       elseif(_${v}_LAST)
371         set(_${v}_CHANGED 1)
372       endif()
373       if(_${v}_CHANGED)
374         set(${changed_var} 1)
375       endif()
376     else()
377       set(_${v}_CHANGED 0)
378     endif()
379   endforeach()
380 endmacro()
381
382 #
383 # Find the given library (var).
384 # Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
385 #
386 macro(_Boost_FIND_LIBRARY var build_type)
387
388   find_library(${var} ${ARGN})
389
390   if(${var})
391     # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
392     if(NOT Boost_LIBRARY_DIR_${build_type})
393       get_filename_component(_dir "${${var}}" PATH)
394       set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
395     endif()
396   elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
397     # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
398     find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
399   endif()
400
401   # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
402   if(Boost_LIBRARY_DIR_${build_type})
403     set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
404     if(Boost_DEBUG)
405       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
406         " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
407         " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
408     endif()
409   endif()
410 endmacro()
411
412 #-------------------------------------------------------------------------------
413
414 # Convert CMAKE_CXX_COMPILER_VERSION to boost compiler suffix version.
415 function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION _OUTPUT_VERSION_MAJOR _OUTPUT_VERSION_MINOR)
416   string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1"
417     _boost_COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}")
418   string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\2"
419     _boost_COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}")
420
421   set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}${_boost_COMPILER_VERSION_MINOR}")
422
423   set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
424   set(${_OUTPUT_VERSION_MAJOR} ${_boost_COMPILER_VERSION_MAJOR} PARENT_SCOPE)
425   set(${_OUTPUT_VERSION_MINOR} ${_boost_COMPILER_VERSION_MINOR} PARENT_SCOPE)
426 endfunction()
427
428 #
429 # Take a list of libraries with "thread" in it
430 # and prepend duplicates with "thread_${Boost_THREADAPI}"
431 # at the front of the list
432 #
433 function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
434   set(_orig_libnames ${ARGN})
435   string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}")
436   set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
437 endfunction()
438
439 #
440 # If a library is found, replace its cache entry with its REALPATH
441 #
442 function(_Boost_SWAP_WITH_REALPATH _library _docstring)
443   if(${_library})
444     get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
445     unset(${_library} CACHE)
446     set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
447   endif()
448 endfunction()
449
450 function(_Boost_CHECK_SPELLING _var)
451   if(${_var})
452     string(TOUPPER ${_var} _var_UC)
453     message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling.  The proper spelling is ${_var_UC}.")
454   endif()
455 endfunction()
456
457 # Guesses Boost's compiler prefix used in built library names
458 # Returns the guess by setting the variable pointed to by _ret
459 function(_Boost_GUESS_COMPILER_PREFIX _ret)
460   if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
461     if(WIN32)
462       set (_boost_COMPILER "-iw")
463     else()
464       set (_boost_COMPILER "-il")
465     endif()
466   elseif (GHSMULTI)
467     set(_boost_COMPILER "-ghs")
468   elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
469     if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
470       set(_boost_COMPILER "-vc141;-vc140")
471     elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
472       set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
473     elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
474       set(_boost_COMPILER "-vc71")
475     elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
476       set(_boost_COMPILER "-vc7") # yes, this is correct
477     else() # VS 6.0 Good luck!
478       set(_boost_COMPILER "-vc6") # yes, this is correct
479     endif()
480   elseif (BORLAND)
481     set(_boost_COMPILER "-bcb")
482   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
483     set(_boost_COMPILER "-sw")
484   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL")
485     set(_boost_COMPILER "-xlc")
486   elseif (MINGW)
487     if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
488         set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
489     else()
490       _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR)
491       set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
492     endif()
493   elseif (UNIX)
494     _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION _boost_COMPILER_VERSION_MAJOR _boost_COMPILER_VERSION_MINOR)
495     if(NOT Boost_VERSION VERSION_LESS 106900)
496       # From GCC 5 and clang 4, versioning changes and minor becomes patch.
497       # For those compilers, patch is exclude from compiler tag in Boost 1.69+ library naming.
498       if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 4)
499         set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}")
500       elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND _boost_COMPILER_VERSION_MAJOR VERSION_GREATER 3)
501         set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}")
502       endif()
503     endif()
504
505     if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
506       if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
507         set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
508       else()
509         # Determine which version of GCC we have.
510         if(APPLE)
511           if(Boost_MINOR_VERSION)
512             if(${Boost_MINOR_VERSION} GREATER 35)
513               # In Boost 1.36.0 and newer, the mangled compiler name used
514               # on macOS/Darwin is "xgcc".
515               set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
516             else()
517               # In Boost <= 1.35.0, there is no mangled compiler name for
518               # the macOS/Darwin version of GCC.
519               set(_boost_COMPILER "")
520             endif()
521           else()
522             # We don't know the Boost version, so assume it's
523             # pre-1.36.0.
524             set(_boost_COMPILER "")
525           endif()
526         else()
527           set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
528         endif()
529       endif()
530     elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
531       # TODO: Find out any Boost version constraints vs clang support.
532       set(_boost_COMPILER "-clang${_boost_COMPILER_VERSION}")
533     endif()
534   else()
535     # TODO at least Boost_DEBUG here?
536     set(_boost_COMPILER "")
537   endif()
538   set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
539 endfunction()
540
541 #
542 # Get component dependencies.  Requires the dependencies to have been
543 # defined for the Boost release version.
544 #
545 # component - the component to check
546 # _ret - list of library dependencies
547 #
548 function(_Boost_COMPONENT_DEPENDENCIES component _ret)
549   # Note: to add a new Boost release, run
550   #
551   #   % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake
552   #
553   # The output may be added in a new block below.  If it's the same as
554   # the previous release, simply update the version range of the block
555   # for the previous release.  Also check if any new components have
556   # been added, and add any new components to
557   # _Boost_COMPONENT_HEADERS.
558   #
559   # This information was originally generated by running
560   # BoostScanDeps.cmake against every boost release to date supported
561   # by FindBoost:
562   #
563   #   % for version in /path/to/boost/sources/*
564   #     do
565   #       cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake
566   #     done
567   #
568   # The output was then updated by search and replace with these regexes:
569   #
570   # - Strip message(STATUS) prefix dashes
571   #   s;^-- ;;
572   # - Indent
573   #   s;^set(;    set(;;
574   # - Add conditionals
575   #   s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*);  elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx);
576   #
577   # This results in the logic seen below, but will require the xxxx
578   # replacing with the following Boost release version (or the next
579   # minor version to be released, e.g. 1.59 was the latest at the time
580   # of writing, making 1.60 the next, so 106000 is the needed version
581   # number).  Identical consecutive releases were then merged together
582   # by updating the end range of the first block and removing the
583   # following redundant blocks.
584   #
585   # Running the script against all historical releases should be
586   # required only if the BoostScanDeps.cmake script logic is changed.
587   # The addition of a new release should only require it to be run
588   # against the new release.
589
590   # Handle Python version suffixes
591   if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
592     set(component "${CMAKE_MATCH_1}")
593     set(component_python_version "${CMAKE_MATCH_2}")
594   endif()
595
596   set(_Boost_IMPORTED_TARGETS TRUE)
597   if(Boost_VERSION AND Boost_VERSION VERSION_LESS 103300)
598     message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)")
599     set(_Boost_IMPORTED_TARGETS FALSE)
600   elseif(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500)
601     set(_Boost_IOSTREAMS_DEPENDENCIES regex thread)
602     set(_Boost_REGEX_DEPENDENCIES thread)
603     set(_Boost_WAVE_DEPENDENCIES filesystem thread)
604     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
605   elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600)
606     set(_Boost_FILESYSTEM_DEPENDENCIES system)
607     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
608     set(_Boost_MPI_DEPENDENCIES serialization)
609     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
610     set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
611     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
612   elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800)
613     set(_Boost_FILESYSTEM_DEPENDENCIES system)
614     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
615     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
616     set(_Boost_MPI_DEPENDENCIES serialization)
617     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
618     set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
619     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
620   elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300)
621     set(_Boost_FILESYSTEM_DEPENDENCIES system)
622     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
623     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
624     set(_Boost_MPI_DEPENDENCIES serialization)
625     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
626     set(_Boost_THREAD_DEPENDENCIES date_time)
627     set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
628     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
629   elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400)
630     set(_Boost_FILESYSTEM_DEPENDENCIES system)
631     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
632     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
633     set(_Boost_MPI_DEPENDENCIES serialization)
634     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
635     set(_Boost_THREAD_DEPENDENCIES date_time)
636     set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
637     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
638   elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500)
639     set(_Boost_FILESYSTEM_DEPENDENCIES system)
640     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
641     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization)
642     set(_Boost_MPI_DEPENDENCIES serialization)
643     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
644     set(_Boost_THREAD_DEPENDENCIES date_time)
645     set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time)
646     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
647   elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700)
648     set(_Boost_FILESYSTEM_DEPENDENCIES system)
649     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
650     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
651     set(_Boost_MPI_DEPENDENCIES serialization)
652     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
653     set(_Boost_THREAD_DEPENDENCIES date_time)
654     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
655     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
656   elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800)
657     set(_Boost_CHRONO_DEPENDENCIES system)
658     set(_Boost_FILESYSTEM_DEPENDENCIES system)
659     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
660     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
661     set(_Boost_MPI_DEPENDENCIES serialization)
662     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
663     set(_Boost_THREAD_DEPENDENCIES date_time)
664     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
665     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
666   elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000)
667     set(_Boost_CHRONO_DEPENDENCIES system)
668     set(_Boost_FILESYSTEM_DEPENDENCIES system)
669     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
670     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
671     set(_Boost_MPI_DEPENDENCIES serialization)
672     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
673     set(_Boost_THREAD_DEPENDENCIES date_time)
674     set(_Boost_TIMER_DEPENDENCIES chrono system)
675     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
676     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
677   elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300)
678     set(_Boost_CHRONO_DEPENDENCIES system)
679     set(_Boost_FILESYSTEM_DEPENDENCIES system)
680     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
681     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
682     set(_Boost_MPI_DEPENDENCIES serialization)
683     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
684     set(_Boost_THREAD_DEPENDENCIES chrono system date_time)
685     set(_Boost_TIMER_DEPENDENCIES chrono system)
686     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
687     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
688   elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400)
689     set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
690     set(_Boost_CHRONO_DEPENDENCIES system)
691     set(_Boost_FILESYSTEM_DEPENDENCIES system)
692     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
693     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
694     set(_Boost_MPI_DEPENDENCIES serialization)
695     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
696     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
697     set(_Boost_TIMER_DEPENDENCIES chrono system)
698     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
699     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
700   elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500)
701     set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
702     set(_Boost_CHRONO_DEPENDENCIES system)
703     set(_Boost_FILESYSTEM_DEPENDENCIES system)
704     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
705     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
706     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
707     set(_Boost_MPI_DEPENDENCIES serialization)
708     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
709     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
710     set(_Boost_TIMER_DEPENDENCIES chrono system)
711     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
712     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
713   elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600)
714     set(_Boost_CHRONO_DEPENDENCIES system)
715     set(_Boost_COROUTINE_DEPENDENCIES context system)
716     set(_Boost_FILESYSTEM_DEPENDENCIES system)
717     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
718     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
719     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
720     set(_Boost_MPI_DEPENDENCIES serialization)
721     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
722     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
723     set(_Boost_TIMER_DEPENDENCIES chrono system)
724     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
725     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
726   elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900)
727     set(_Boost_CHRONO_DEPENDENCIES system)
728     set(_Boost_COROUTINE_DEPENDENCIES context system)
729     set(_Boost_FILESYSTEM_DEPENDENCIES system)
730     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
731     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
732     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
733     set(_Boost_MPI_DEPENDENCIES serialization)
734     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
735     set(_Boost_RANDOM_DEPENDENCIES system)
736     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
737     set(_Boost_TIMER_DEPENDENCIES chrono system)
738     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
739     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
740   elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000)
741     set(_Boost_CHRONO_DEPENDENCIES system)
742     set(_Boost_COROUTINE_DEPENDENCIES context system)
743     set(_Boost_FILESYSTEM_DEPENDENCIES system)
744     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
745     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic)
746     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
747     set(_Boost_MPI_DEPENDENCIES serialization)
748     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
749     set(_Boost_RANDOM_DEPENDENCIES system)
750     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
751     set(_Boost_TIMER_DEPENDENCIES chrono system)
752     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
753     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
754   elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100)
755     set(_Boost_CHRONO_DEPENDENCIES system)
756     set(_Boost_COROUTINE_DEPENDENCIES context system)
757     set(_Boost_FILESYSTEM_DEPENDENCIES system)
758     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
759     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
760     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
761     set(_Boost_MPI_DEPENDENCIES serialization)
762     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
763     set(_Boost_RANDOM_DEPENDENCIES system)
764     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
765     set(_Boost_TIMER_DEPENDENCIES chrono system)
766     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
767     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
768   elseif(NOT Boost_VERSION VERSION_LESS 106100 AND Boost_VERSION VERSION_LESS 106200)
769     set(_Boost_CHRONO_DEPENDENCIES system)
770     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
771     set(_Boost_COROUTINE_DEPENDENCIES context system)
772     set(_Boost_FILESYSTEM_DEPENDENCIES system)
773     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
774     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
775     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
776     set(_Boost_MPI_DEPENDENCIES serialization)
777     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
778     set(_Boost_RANDOM_DEPENDENCIES system)
779     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
780     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
781     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
782   elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300)
783     set(_Boost_CHRONO_DEPENDENCIES system)
784     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
785     set(_Boost_COROUTINE_DEPENDENCIES context system)
786     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
787     set(_Boost_FILESYSTEM_DEPENDENCIES system)
788     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
789     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
790     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
791     set(_Boost_MPI_DEPENDENCIES serialization)
792     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
793     set(_Boost_RANDOM_DEPENDENCIES system)
794     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
795     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
796     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
797   elseif(NOT Boost_VERSION VERSION_LESS 106300 AND Boost_VERSION VERSION_LESS 106500)
798     set(_Boost_CHRONO_DEPENDENCIES system)
799     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
800     set(_Boost_COROUTINE_DEPENDENCIES context system)
801     set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time)
802     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
803     set(_Boost_FILESYSTEM_DEPENDENCIES system)
804     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
805     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
806     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
807     set(_Boost_MPI_DEPENDENCIES serialization)
808     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
809     set(_Boost_RANDOM_DEPENDENCIES system)
810     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
811     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
812     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
813   elseif(NOT Boost_VERSION VERSION_LESS 106500 AND Boost_VERSION VERSION_LESS 106700)
814     set(_Boost_CHRONO_DEPENDENCIES system)
815     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
816     set(_Boost_COROUTINE_DEPENDENCIES context system)
817     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
818     set(_Boost_FILESYSTEM_DEPENDENCIES system)
819     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
820     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
821     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
822     set(_Boost_MPI_DEPENDENCIES serialization)
823     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
824     set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
825     set(_Boost_RANDOM_DEPENDENCIES system)
826     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
827     set(_Boost_TIMER_DEPENDENCIES chrono system)
828     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
829     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
830   elseif(NOT Boost_VERSION VERSION_LESS 106700 AND Boost_VERSION VERSION_LESS 106800)
831     set(_Boost_CHRONO_DEPENDENCIES system)
832     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
833     set(_Boost_COROUTINE_DEPENDENCIES context system)
834     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
835     set(_Boost_FILESYSTEM_DEPENDENCIES system)
836     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
837     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
838     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
839     set(_Boost_MPI_DEPENDENCIES serialization)
840     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
841     set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
842     set(_Boost_RANDOM_DEPENDENCIES system)
843     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
844     set(_Boost_TIMER_DEPENDENCIES chrono system)
845     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
846     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
847   elseif(NOT Boost_VERSION VERSION_LESS 106800 AND Boost_VERSION VERSION_LESS 106900)
848     set(_Boost_CHRONO_DEPENDENCIES system)
849     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
850     set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time)
851     set(_Boost_COROUTINE_DEPENDENCIES context system)
852     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
853     set(_Boost_FILESYSTEM_DEPENDENCIES system)
854     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
855     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
856     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
857     set(_Boost_MPI_DEPENDENCIES serialization)
858     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
859     set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
860     set(_Boost_RANDOM_DEPENDENCIES system)
861     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
862     set(_Boost_TIMER_DEPENDENCIES chrono system)
863     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
864     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
865   elseif(NOT Boost_VERSION VERSION_LESS 106900 AND Boost_VERSION VERSION_LESS 107000)
866     set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
867     set(_Boost_COROUTINE_DEPENDENCIES context)
868     set(_Boost_FIBER_DEPENDENCIES context)
869     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
870     set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic)
871     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
872     set(_Boost_MPI_DEPENDENCIES serialization)
873     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
874     set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
875     set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic)
876     set(_Boost_TIMER_DEPENDENCIES chrono system)
877     set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
878     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
879   else()
880     if(NOT Boost_VERSION VERSION_LESS 107000)
881       set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time)
882       set(_Boost_COROUTINE_DEPENDENCIES context)
883       set(_Boost_FIBER_DEPENDENCIES context)
884       set(_Boost_IOSTREAMS_DEPENDENCIES regex)
885       set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic)
886       set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
887       set(_Boost_MPI_DEPENDENCIES serialization)
888       set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
889       set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
890       set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic)
891       set(_Boost_TIMER_DEPENDENCIES chrono system)
892       set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic)
893       set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
894     endif()
895     if(NOT Boost_VERSION VERSION_LESS 107100)
896       message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
897     endif()
898   endif()
899
900   string(TOUPPER ${component} uppercomponent)
901   set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
902   set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
903
904   string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}")
905   if (NOT _boost_DEPS_STRING)
906     set(_boost_DEPS_STRING "(none)")
907   endif()
908   # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}")
909 endfunction()
910
911 #
912 # Get component headers.  This is the primary header (or headers) for
913 # a given component, and is used to check that the headers are present
914 # as well as the library itself as an extra sanity check of the build
915 # environment.
916 #
917 # component - the component to check
918 # _hdrs
919 #
920 function(_Boost_COMPONENT_HEADERS component _hdrs)
921   # Handle Python version suffixes
922   if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
923     set(component "${CMAKE_MATCH_1}")
924     set(component_python_version "${CMAKE_MATCH_2}")
925   endif()
926
927   # Note: new boost components will require adding here.  The header
928   # must be present in all versions of Boost providing a library.
929   set(_Boost_ATOMIC_HEADERS              "boost/atomic.hpp")
930   set(_Boost_CHRONO_HEADERS              "boost/chrono.hpp")
931   set(_Boost_CONTAINER_HEADERS           "boost/container/container_fwd.hpp")
932   set(_Boost_CONTRACT_HEADERS            "boost/contract.hpp")
933   if(Boost_VERSION VERSION_LESS 106100)
934     set(_Boost_CONTEXT_HEADERS           "boost/context/all.hpp")
935   else()
936     set(_Boost_CONTEXT_HEADERS           "boost/context/detail/fcontext.hpp")
937   endif()
938   set(_Boost_COROUTINE_HEADERS           "boost/coroutine/all.hpp")
939   set(_Boost_DATE_TIME_HEADERS           "boost/date_time/date.hpp")
940   set(_Boost_EXCEPTION_HEADERS           "boost/exception/exception.hpp")
941   set(_Boost_FIBER_HEADERS               "boost/fiber/all.hpp")
942   set(_Boost_FILESYSTEM_HEADERS          "boost/filesystem/path.hpp")
943   set(_Boost_GRAPH_HEADERS               "boost/graph/adjacency_list.hpp")
944   set(_Boost_GRAPH_PARALLEL_HEADERS      "boost/graph/adjacency_list.hpp")
945   set(_Boost_IOSTREAMS_HEADERS           "boost/iostreams/stream.hpp")
946   set(_Boost_LOCALE_HEADERS              "boost/locale.hpp")
947   set(_Boost_LOG_HEADERS                 "boost/log/core.hpp")
948   set(_Boost_LOG_SETUP_HEADERS           "boost/log/detail/setup_config.hpp")
949   set(_Boost_MATH_HEADERS                "boost/math_fwd.hpp")
950   set(_Boost_MATH_C99_HEADERS            "boost/math/tr1.hpp")
951   set(_Boost_MATH_C99F_HEADERS           "boost/math/tr1.hpp")
952   set(_Boost_MATH_C99L_HEADERS           "boost/math/tr1.hpp")
953   set(_Boost_MATH_TR1_HEADERS            "boost/math/tr1.hpp")
954   set(_Boost_MATH_TR1F_HEADERS           "boost/math/tr1.hpp")
955   set(_Boost_MATH_TR1L_HEADERS           "boost/math/tr1.hpp")
956   set(_Boost_MPI_HEADERS                 "boost/mpi.hpp")
957   set(_Boost_MPI_PYTHON_HEADERS          "boost/mpi/python/config.hpp")
958   set(_Boost_NUMPY_HEADERS               "boost/python/numpy.hpp")
959   set(_Boost_PRG_EXEC_MONITOR_HEADERS    "boost/test/prg_exec_monitor.hpp")
960   set(_Boost_PROGRAM_OPTIONS_HEADERS     "boost/program_options.hpp")
961   set(_Boost_PYTHON_HEADERS              "boost/python.hpp")
962   set(_Boost_RANDOM_HEADERS              "boost/random.hpp")
963   set(_Boost_REGEX_HEADERS               "boost/regex.hpp")
964   set(_Boost_SERIALIZATION_HEADERS       "boost/serialization/serialization.hpp")
965   set(_Boost_SIGNALS_HEADERS             "boost/signals.hpp")
966   set(_Boost_STACKTRACE_ADDR2LINE_HEADERS "boost/stacktrace.hpp")
967   set(_Boost_STACKTRACE_BACKTRACE_HEADERS "boost/stacktrace.hpp")
968   set(_Boost_STACKTRACE_BASIC_HEADERS    "boost/stacktrace.hpp")
969   set(_Boost_STACKTRACE_NOOP_HEADERS     "boost/stacktrace.hpp")
970   set(_Boost_STACKTRACE_WINDBG_CACHED_HEADERS "boost/stacktrace.hpp")
971   set(_Boost_STACKTRACE_WINDBG_HEADERS   "boost/stacktrace.hpp")
972   set(_Boost_SYSTEM_HEADERS              "boost/system/config.hpp")
973   set(_Boost_TEST_EXEC_MONITOR_HEADERS   "boost/test/test_exec_monitor.hpp")
974   set(_Boost_THREAD_HEADERS              "boost/thread.hpp")
975   set(_Boost_TIMER_HEADERS               "boost/timer.hpp")
976   set(_Boost_TYPE_ERASURE_HEADERS        "boost/type_erasure/config.hpp")
977   set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp")
978   set(_Boost_WAVE_HEADERS                "boost/wave.hpp")
979   set(_Boost_WSERIALIZATION_HEADERS      "boost/archive/text_wiarchive.hpp")
980   if(WIN32)
981     set(_Boost_BZIP2_HEADERS             "boost/iostreams/filter/bzip2.hpp")
982     set(_Boost_ZLIB_HEADERS              "boost/iostreams/filter/zlib.hpp")
983   endif()
984
985   string(TOUPPER ${component} uppercomponent)
986   set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE)
987
988   string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}")
989   if (NOT _boost_HDRS_STRING)
990     set(_boost_HDRS_STRING "(none)")
991   endif()
992   # message(STATUS "Headers for Boost::${component}: ${_boost_HDRS_STRING}")
993 endfunction()
994
995 #
996 # Determine if any missing dependencies require adding to the component list.
997 #
998 # Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component,
999 # plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be
1000 # defined; FALSE if dependency information is unavailable).
1001 #
1002 # componentvar - the component list variable name
1003 # extravar - the indirect dependency list variable name
1004 #
1005 #
1006 function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
1007   # _boost_unprocessed_components - list of components requiring processing
1008   # _boost_processed_components - components already processed (or currently being processed)
1009   # _boost_new_components - new components discovered for future processing
1010   #
1011   list(APPEND _boost_unprocessed_components ${${componentvar}})
1012
1013   while(_boost_unprocessed_components)
1014     list(APPEND _boost_processed_components ${_boost_unprocessed_components})
1015     foreach(component ${_boost_unprocessed_components})
1016       string(TOUPPER ${component} uppercomponent)
1017       set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
1018       _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES)
1019       set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
1020       set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
1021       foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
1022         if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components))
1023           list(APPEND _boost_new_components ${componentdep})
1024         endif()
1025       endforeach()
1026     endforeach()
1027     set(_boost_unprocessed_components ${_boost_new_components})
1028     unset(_boost_new_components)
1029   endwhile()
1030   set(_boost_extra_components ${_boost_processed_components})
1031   if(_boost_extra_components AND ${componentvar})
1032     list(REMOVE_ITEM _boost_extra_components ${${componentvar}})
1033   endif()
1034   set(${componentvar} ${_boost_processed_components} PARENT_SCOPE)
1035   set(${extravar} ${_boost_extra_components} PARENT_SCOPE)
1036 endfunction()
1037
1038 #
1039 # Some boost libraries may require particular set of compler features.
1040 # The very first one was `boost::fiber` introduced in Boost 1.62.
1041 # One can check required compiler features of it in
1042 # `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`.
1043 #
1044 function(_Boost_COMPILER_FEATURES component _ret)
1045   # Boost >= 1.62 and < 1.67
1046   if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106700)
1047     set(_Boost_FIBER_COMPILER_FEATURES
1048         cxx_alias_templates
1049         cxx_auto_type
1050         cxx_constexpr
1051         cxx_defaulted_functions
1052         cxx_final
1053         cxx_lambdas
1054         cxx_noexcept
1055         cxx_nullptr
1056         cxx_rvalue_references
1057         cxx_thread_local
1058         cxx_variadic_templates
1059     )
1060   endif()
1061   string(TOUPPER ${component} uppercomponent)
1062   set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE)
1063 endfunction()
1064
1065 #
1066 # Update library search directory hint variable with paths used by prebuilt boost binaries.
1067 #
1068 # Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/)
1069 # have library directories named using MSVC compiler version and architecture.
1070 # This function would append corresponding directories if MSVC is a current compiler,
1071 # so having `BOOST_ROOT` would be enough to specify to find everything.
1072 #
1073 function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
1074   if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
1075     if(CMAKE_SIZEOF_VOID_P EQUAL 8)
1076       set(_arch_suffix 64)
1077     else()
1078       set(_arch_suffix 32)
1079     endif()
1080     if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
1081       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
1082       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
1083     elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
1084       math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10")
1085       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.0)
1086     endif()
1087     set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE)
1088   endif()
1089 endfunction()
1090
1091 #
1092 # End functions/macros
1093 #
1094 #-------------------------------------------------------------------------------
1095
1096 #-------------------------------------------------------------------------------
1097 # main.
1098 #-------------------------------------------------------------------------------
1099
1100
1101 # If the user sets Boost_LIBRARY_DIR, use it as the default for both
1102 # configurations.
1103 if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
1104   set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
1105 endif()
1106 if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
1107   set(Boost_LIBRARY_DIR_DEBUG   "${Boost_LIBRARY_DIR}")
1108 endif()
1109
1110 if(NOT DEFINED Boost_USE_DEBUG_LIBS)
1111   set(Boost_USE_DEBUG_LIBS TRUE)
1112 endif()
1113 if(NOT DEFINED Boost_USE_RELEASE_LIBS)
1114   set(Boost_USE_RELEASE_LIBS TRUE)
1115 endif()
1116 if(NOT DEFINED Boost_USE_MULTITHREADED)
1117   set(Boost_USE_MULTITHREADED TRUE)
1118 endif()
1119 if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
1120   set(Boost_USE_DEBUG_RUNTIME TRUE)
1121 endif()
1122
1123 # Check the version of Boost against the requested version.
1124 if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
1125   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")
1126 endif()
1127
1128 if(Boost_FIND_VERSION_EXACT)
1129   # The version may appear in a directory with or without the patch
1130   # level, even when the patch level is non-zero.
1131   set(_boost_TEST_VERSIONS
1132     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
1133     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
1134 else()
1135   # The user has not requested an exact version.  Among known
1136   # versions, find those that are acceptable to the user request.
1137   #
1138   # Note: When adding a new Boost release, also update the dependency
1139   # information in _Boost_COMPONENT_DEPENDENCIES and
1140   # _Boost_COMPONENT_HEADERS.  See the instructions at the top of
1141   # _Boost_COMPONENT_DEPENDENCIES.
1142   set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
1143     "1.70.0" "1.70" "1.69.0" "1.69"
1144     "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
1145     "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
1146     "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
1147     "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
1148     "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
1149     "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"
1150     "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"
1151     "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
1152     "1.34" "1.33.1" "1.33.0" "1.33")
1153
1154   set(_boost_TEST_VERSIONS)
1155   if(Boost_FIND_VERSION)
1156     set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
1157     # Select acceptable versions.
1158     foreach(version ${_Boost_KNOWN_VERSIONS})
1159       if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
1160         # This version is high enough.
1161         list(APPEND _boost_TEST_VERSIONS "${version}")
1162       elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
1163         # This version is a short-form for the requested version with
1164         # the patch level dropped.
1165         list(APPEND _boost_TEST_VERSIONS "${version}")
1166       endif()
1167     endforeach()
1168   else()
1169     # Any version is acceptable.
1170     set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
1171   endif()
1172 endif()
1173
1174 # The reason that we failed to find Boost. This will be set to a
1175 # user-friendly message when we fail to find some necessary piece of
1176 # Boost.
1177 set(Boost_ERROR_REASON)
1178
1179 if(Boost_DEBUG)
1180   # Output some of their choices
1181   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1182                  "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
1183   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1184                  "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
1185   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1186                  "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
1187   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1188                  "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
1189   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1190                  "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
1191   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1192                  "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
1193 endif()
1194
1195 # Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It
1196 # will only contain any interface definitions on WIN32, but is created
1197 # on all platforms to keep end user code free from platform dependent
1198 # code.  Also provide convenience targets to disable autolinking and
1199 # enable dynamic linking.
1200 if(NOT TARGET Boost::diagnostic_definitions)
1201   add_library(Boost::diagnostic_definitions INTERFACE IMPORTED)
1202   add_library(Boost::disable_autolinking INTERFACE IMPORTED)
1203   add_library(Boost::dynamic_linking INTERFACE IMPORTED)
1204   set_target_properties(Boost::dynamic_linking PROPERTIES
1205     INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK")
1206 endif()
1207 if(WIN32)
1208   # In windows, automatic linking is performed, so you do not have
1209   # to specify the libraries.  If you are linking to a dynamic
1210   # runtime, then you can choose to link to either a static or a
1211   # dynamic Boost library, the default is to do a static link.  You
1212   # can alter this for a specific library "whatever" by defining
1213   # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
1214   # linked dynamically.  Alternatively you can force all Boost
1215   # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
1216
1217   # This feature can be disabled for Boost library "whatever" by
1218   # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
1219   # BOOST_ALL_NO_LIB.
1220
1221   # If you want to observe which libraries are being linked against
1222   # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
1223   # code to emit a #pragma message each time a library is selected
1224   # for linking.
1225   set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
1226   set_target_properties(Boost::diagnostic_definitions PROPERTIES
1227     INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC")
1228   set_target_properties(Boost::disable_autolinking PROPERTIES
1229     INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB")
1230 endif()
1231
1232 _Boost_CHECK_SPELLING(Boost_ROOT)
1233 _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
1234 _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
1235
1236 # Collect environment variable inputs as hints.  Do not consider changes.
1237 foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
1238   set(_env $ENV{${v}})
1239   if(_env)
1240     file(TO_CMAKE_PATH "${_env}" _ENV_${v})
1241   else()
1242     set(_ENV_${v} "")
1243   endif()
1244 endforeach()
1245 if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
1246   set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
1247 endif()
1248
1249 # Collect inputs and cached results.  Detect changes since the last run.
1250 if(NOT BOOST_ROOT AND BOOSTROOT)
1251   set(BOOST_ROOT "${BOOSTROOT}")
1252 endif()
1253 set(_Boost_VARS_DIR
1254   BOOST_ROOT
1255   Boost_NO_SYSTEM_PATHS
1256   )
1257
1258 if(Boost_DEBUG)
1259   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1260                  "Declared as CMake or Environmental Variables:")
1261   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1262                  "  BOOST_ROOT = ${BOOST_ROOT}")
1263   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1264                  "  BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
1265   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1266                  "  BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
1267   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1268                  "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
1269 endif()
1270
1271 # ------------------------------------------------------------------------
1272 #  Search for Boost include DIR
1273 # ------------------------------------------------------------------------
1274
1275 set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
1276 _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
1277 # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
1278 # location did.  We will find a new one based on the new inputs.
1279 if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
1280   unset(Boost_INCLUDE_DIR CACHE)
1281 endif()
1282
1283 if(NOT Boost_INCLUDE_DIR)
1284   set(_boost_INCLUDE_SEARCH_DIRS "")
1285   if(BOOST_INCLUDEDIR)
1286     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
1287   elseif(_ENV_BOOST_INCLUDEDIR)
1288     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
1289   endif()
1290
1291   if( BOOST_ROOT )
1292     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
1293   elseif( _ENV_BOOST_ROOT )
1294     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
1295   endif()
1296
1297   if( Boost_NO_SYSTEM_PATHS)
1298     list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
1299   else()
1300     if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
1301       foreach(ver ${_boost_TEST_VERSIONS})
1302         string(REPLACE "." "_" ver "${ver}")
1303         list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}")
1304       endforeach()
1305     endif()
1306     list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
1307       C:/boost/include
1308       C:/boost
1309       /sw/local/include
1310       )
1311   endif()
1312
1313   # Try to find Boost by stepping backwards through the Boost versions
1314   # we know about.
1315   # Build a list of path suffixes for each version.
1316   set(_boost_PATH_SUFFIXES)
1317   foreach(_boost_VER ${_boost_TEST_VERSIONS})
1318     # Add in a path suffix, based on the required version, ideally
1319     # we could read this from version.hpp, but for that to work we'd
1320     # need to know the include dir already
1321     set(_boost_BOOSTIFIED_VERSION)
1322
1323     # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
1324     if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
1325         set(_boost_BOOSTIFIED_VERSION
1326           "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
1327     elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
1328         set(_boost_BOOSTIFIED_VERSION
1329           "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
1330     endif()
1331
1332     list(APPEND _boost_PATH_SUFFIXES
1333       "boost-${_boost_BOOSTIFIED_VERSION}"
1334       "boost_${_boost_BOOSTIFIED_VERSION}"
1335       "boost/boost-${_boost_BOOSTIFIED_VERSION}"
1336       "boost/boost_${_boost_BOOSTIFIED_VERSION}"
1337       )
1338
1339   endforeach()
1340
1341   if(Boost_DEBUG)
1342     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1343                    "Include debugging info:")
1344     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1345                    "  _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
1346     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1347                    "  _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
1348   endif()
1349
1350   # Look for a standard boost header file.
1351   find_path(Boost_INCLUDE_DIR
1352     NAMES         boost/config.hpp
1353     HINTS         ${_boost_INCLUDE_SEARCH_DIRS}
1354     PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
1355     )
1356 endif()
1357
1358 # ------------------------------------------------------------------------
1359 #  Extract version information from version.hpp
1360 # ------------------------------------------------------------------------
1361
1362 # Set Boost_FOUND based only on header location and version.
1363 # It will be updated below for component libraries.
1364 if(Boost_INCLUDE_DIR)
1365   if(Boost_DEBUG)
1366     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1367                    "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
1368   endif()
1369
1370   # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
1371   set(Boost_VERSION 0)
1372   set(Boost_LIB_VERSION "")
1373   file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
1374   set(_Boost_VERSION_REGEX "([0-9]+)")
1375   set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
1376   foreach(v VERSION LIB_VERSION)
1377     if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
1378       set(Boost_${v} "${CMAKE_MATCH_1}")
1379     endif()
1380   endforeach()
1381   unset(_boost_VERSION_HPP_CONTENTS)
1382
1383   math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
1384   math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
1385   math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
1386   set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
1387
1388   string(APPEND Boost_ERROR_REASON
1389     "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
1390   if(Boost_DEBUG)
1391     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1392                    "version.hpp reveals boost "
1393                    "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
1394   endif()
1395
1396   if(Boost_FIND_VERSION)
1397     # Set Boost_FOUND based on requested version.
1398     set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
1399     if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
1400       set(Boost_FOUND 0)
1401       set(_Boost_VERSION_AGE "old")
1402     elseif(Boost_FIND_VERSION_EXACT AND
1403         NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
1404       set(Boost_FOUND 0)
1405       set(_Boost_VERSION_AGE "new")
1406     else()
1407       set(Boost_FOUND 1)
1408     endif()
1409     if(NOT Boost_FOUND)
1410       # State that we found a version of Boost that is too new or too old.
1411       string(APPEND Boost_ERROR_REASON
1412         "\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
1413       if (Boost_FIND_VERSION_PATCH)
1414         string(APPEND Boost_ERROR_REASON
1415           ".${Boost_FIND_VERSION_PATCH}")
1416       endif ()
1417       if (NOT Boost_FIND_VERSION_EXACT)
1418         string(APPEND Boost_ERROR_REASON " (or newer)")
1419       endif ()
1420       string(APPEND Boost_ERROR_REASON ".")
1421     endif ()
1422   else()
1423     # Caller will accept any Boost version.
1424     set(Boost_FOUND 1)
1425   endif()
1426 else()
1427   set(Boost_FOUND 0)
1428   string(APPEND Boost_ERROR_REASON
1429     "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.")
1430 endif()
1431
1432 # ------------------------------------------------------------------------
1433 #  Prefix initialization
1434 # ------------------------------------------------------------------------
1435
1436 set(Boost_LIB_PREFIX "")
1437 if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR
1438     (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) )
1439   set(Boost_LIB_PREFIX "lib")
1440 endif()
1441
1442 if ( NOT Boost_NAMESPACE )
1443   set(Boost_NAMESPACE "boost")
1444 endif()
1445
1446 if(Boost_DEBUG)
1447   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1448     "Boost_LIB_PREFIX = ${Boost_LIB_PREFIX}")
1449   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1450     "Boost_NAMESPACE = ${Boost_NAMESPACE}")
1451 endif()
1452
1453 # ------------------------------------------------------------------------
1454 #  Suffix initialization and compiler suffix detection.
1455 # ------------------------------------------------------------------------
1456
1457 set(_Boost_VARS_NAME
1458   Boost_NAMESPACE
1459   Boost_COMPILER
1460   Boost_THREADAPI
1461   Boost_USE_DEBUG_PYTHON
1462   Boost_USE_MULTITHREADED
1463   Boost_USE_STATIC_LIBS
1464   Boost_USE_STATIC_RUNTIME
1465   Boost_USE_STLPORT
1466   Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
1467   )
1468 _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
1469
1470 # Setting some more suffixes for the library
1471 if (Boost_COMPILER)
1472   set(_boost_COMPILER ${Boost_COMPILER})
1473   if(Boost_DEBUG)
1474     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1475                    "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
1476   endif()
1477 else()
1478   # Attempt to guess the compiler suffix
1479   # NOTE: this is not perfect yet, if you experience any issues
1480   # please report them and use the Boost_COMPILER variable
1481   # to work around the problems.
1482   _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
1483   if(Boost_DEBUG)
1484     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1485       "guessed _boost_COMPILER = ${_boost_COMPILER}")
1486   endif()
1487 endif()
1488
1489 set (_boost_MULTITHREADED "-mt")
1490 if( NOT Boost_USE_MULTITHREADED )
1491   set (_boost_MULTITHREADED "")
1492 endif()
1493 if(Boost_DEBUG)
1494   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1495     "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
1496 endif()
1497
1498 #======================
1499 # Systematically build up the Boost ABI tag for the 'tagged' and 'versioned' layouts
1500 # http://boost.org/doc/libs/1_66_0/more/getting_started/windows.html#library-naming
1501 # http://boost.org/doc/libs/1_66_0/boost/config/auto_link.hpp
1502 # http://boost.org/doc/libs/1_66_0/tools/build/src/tools/common.jam
1503 # http://boost.org/doc/libs/1_66_0/boostcpp.jam
1504 set( _boost_RELEASE_ABI_TAG "-")
1505 set( _boost_DEBUG_ABI_TAG   "-")
1506 # Key       Use this library when:
1507 #  s        linking statically to the C++ standard library and
1508 #           compiler runtime support libraries.
1509 if(Boost_USE_STATIC_RUNTIME)
1510   set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
1511   set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}s")
1512 endif()
1513 #  g        using debug versions of the standard and runtime
1514 #           support libraries
1515 if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
1516   if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
1517           OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang"
1518           OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel")
1519     string(APPEND _boost_DEBUG_ABI_TAG "g")
1520   endif()
1521 endif()
1522 #  y        using special debug build of python
1523 if(Boost_USE_DEBUG_PYTHON)
1524   string(APPEND _boost_DEBUG_ABI_TAG "y")
1525 endif()
1526 #  d        using a debug version of your code
1527 string(APPEND _boost_DEBUG_ABI_TAG "d")
1528 #  p        using the STLport standard library rather than the
1529 #           default one supplied with your compiler
1530 if(Boost_USE_STLPORT)
1531   string(APPEND _boost_RELEASE_ABI_TAG "p")
1532   string(APPEND _boost_DEBUG_ABI_TAG "p")
1533 endif()
1534 #  n        using the STLport deprecated "native iostreams" feature
1535 #           removed from the documentation in 1.43.0 but still present in
1536 #           boost/config/auto_link.hpp
1537 if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
1538   string(APPEND _boost_RELEASE_ABI_TAG "n")
1539   string(APPEND _boost_DEBUG_ABI_TAG "n")
1540 endif()
1541
1542 #  -x86     Architecture and address model tag
1543 #           First character is the architecture, then word-size, either 32 or 64
1544 #           Only used in 'versioned' layout, added in Boost 1.66.0
1545 if(DEFINED Boost_ARCHITECTURE)
1546   set(_boost_ARCHITECTURE_TAG "${Boost_ARCHITECTURE}")
1547   if(Boost_DEBUG)
1548     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1549       "using user-specified Boost_ARCHITECTURE = ${_boost_ARCHITECTURE_TAG}")
1550   endif()
1551 else()
1552   set(_boost_ARCHITECTURE_TAG "")
1553   # {CMAKE_CXX_COMPILER_ARCHITECTURE_ID} is not currently set for all compilers
1554   if(NOT "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x" AND NOT Boost_VERSION VERSION_LESS 106600)
1555     string(APPEND _boost_ARCHITECTURE_TAG "-")
1556     # This needs to be kept in-sync with the section of CMakePlatformId.h.in
1557     # inside 'defined(_WIN32) && defined(_MSC_VER)'
1558     if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "IA64")
1559       string(APPEND _boost_ARCHITECTURE_TAG "i")
1560     elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "X86"
1561               OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
1562       string(APPEND _boost_ARCHITECTURE_TAG "x")
1563     elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID MATCHES "^ARM")
1564       string(APPEND _boost_ARCHITECTURE_TAG "a")
1565     elseif(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "MIPS")
1566       string(APPEND _boost_ARCHITECTURE_TAG "m")
1567     endif()
1568
1569     if(CMAKE_SIZEOF_VOID_P EQUAL 8)
1570       string(APPEND _boost_ARCHITECTURE_TAG "64")
1571     else()
1572       string(APPEND _boost_ARCHITECTURE_TAG "32")
1573     endif()
1574   endif()
1575 endif()
1576
1577 if(Boost_DEBUG)
1578   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1579     "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
1580   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1581     "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
1582 endif()
1583
1584 # ------------------------------------------------------------------------
1585 #  Begin finding boost libraries
1586 # ------------------------------------------------------------------------
1587
1588 set(_Boost_VARS_LIB "")
1589 foreach(c DEBUG RELEASE)
1590   set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
1591   list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
1592   _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
1593   # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
1594   # location did.  We will find a new one based on the new inputs.
1595   if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
1596     unset(Boost_LIBRARY_DIR_${c} CACHE)
1597   endif()
1598
1599   # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
1600   if(Boost_LIBRARY_DIR_${c})
1601     set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
1602   else()
1603     set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
1604     if(BOOST_LIBRARYDIR)
1605       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
1606     elseif(_ENV_BOOST_LIBRARYDIR)
1607       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
1608     endif()
1609
1610     if(BOOST_ROOT)
1611       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
1612       _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}")
1613     elseif(_ENV_BOOST_ROOT)
1614       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
1615       _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}")
1616     endif()
1617
1618     list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
1619       ${Boost_INCLUDE_DIR}/lib
1620       ${Boost_INCLUDE_DIR}/../lib
1621       ${Boost_INCLUDE_DIR}/stage/lib
1622       )
1623     _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..")
1624     _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}")
1625     if( Boost_NO_SYSTEM_PATHS )
1626       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
1627     else()
1628       foreach(ver ${_boost_TEST_VERSIONS})
1629         string(REPLACE "." "_" ver "${ver}")
1630         _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}")
1631       endforeach()
1632       _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost")
1633       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
1634         C:/boost/lib
1635         C:/boost
1636         /sw/local/lib
1637         )
1638     endif()
1639   endif()
1640 endforeach()
1641
1642 if(Boost_DEBUG)
1643   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1644     "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
1645     "_boost_LIBRARY_SEARCH_DIRS_DEBUG   = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
1646 endif()
1647
1648 # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
1649 if( Boost_USE_STATIC_LIBS )
1650   set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
1651   if(WIN32)
1652     list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a)
1653   else()
1654     set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
1655   endif()
1656 endif()
1657
1658 # We want to use the tag inline below without risking double dashes
1659 if(_boost_RELEASE_ABI_TAG)
1660   if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
1661     set(_boost_RELEASE_ABI_TAG "")
1662   endif()
1663 endif()
1664 if(_boost_DEBUG_ABI_TAG)
1665   if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
1666     set(_boost_DEBUG_ABI_TAG "")
1667   endif()
1668 endif()
1669
1670 # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
1671 # on WIN32 was to:
1672 #  1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
1673 #  2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
1674 # We maintain this behavior since changing it could break people's builds.
1675 # To disable the ambiguous behavior, the user need only
1676 # set Boost_USE_STATIC_RUNTIME either ON or OFF.
1677 set(_boost_STATIC_RUNTIME_WORKAROUND false)
1678 if(WIN32 AND Boost_USE_STATIC_LIBS)
1679   if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
1680     set(_boost_STATIC_RUNTIME_WORKAROUND TRUE)
1681   endif()
1682 endif()
1683
1684 # On versions < 1.35, remove the System library from the considered list
1685 # since it wasn't added until 1.35.
1686 if(Boost_VERSION AND Boost_FIND_COMPONENTS)
1687    if(Boost_VERSION LESS 103500)
1688      list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
1689    endif()
1690 endif()
1691
1692 # Additional components may be required via component dependencies.
1693 # Add any missing components to the list.
1694 _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS)
1695
1696 # If thread is required, get the thread libs as a dependency
1697 if("thread" IN_LIST Boost_FIND_COMPONENTS)
1698   if(Boost_FIND_QUIETLY)
1699     set(_Boost_find_quiet QUIET)
1700   else()
1701     set(_Boost_find_quiet "")
1702   endif()
1703   find_package(Threads ${_Boost_find_quiet})
1704   unset(_Boost_find_quiet)
1705 endif()
1706
1707 # If the user changed any of our control inputs flush previous results.
1708 if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME)
1709   foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
1710     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
1711     foreach(c DEBUG RELEASE)
1712       set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
1713       unset(${_var} CACHE)
1714       set(${_var} "${_var}-NOTFOUND")
1715     endforeach()
1716   endforeach()
1717   set(_Boost_COMPONENTS_SEARCHED "")
1718 endif()
1719
1720 foreach(COMPONENT ${Boost_FIND_COMPONENTS})
1721   string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
1722
1723   set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
1724   set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
1725
1726   # Compute component-specific hints.
1727   set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
1728   if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
1729      ${COMPONENT} STREQUAL "graph_parallel")
1730     foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
1731       if(IS_ABSOLUTE "${lib}")
1732         get_filename_component(libdir "${lib}" PATH)
1733         string(REPLACE "\\" "/" libdir "${libdir}")
1734         list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
1735       endif()
1736     endforeach()
1737   endif()
1738
1739   # Handle Python version suffixes
1740   unset(COMPONENT_PYTHON_VERSION_MAJOR)
1741   unset(COMPONENT_PYTHON_VERSION_MINOR)
1742   if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$")
1743     set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
1744     set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
1745   elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$")
1746     set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
1747     set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
1748     set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}")
1749   endif()
1750
1751   unset(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
1752   if (COMPONENT_PYTHON_VERSION_MINOR)
1753     # Boost >= 1.67
1754     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
1755     # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix)
1756     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
1757     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
1758     # Gentoo
1759     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
1760     # RPMs
1761     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
1762   endif()
1763   if (COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR)
1764     # Boost < 1.67
1765     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}")
1766   endif()
1767
1768   # Consolidate and report component-specific hints.
1769   if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
1770     list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
1771     if(Boost_DEBUG)
1772       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1773         "Component-specific library search names for ${COMPONENT_NAME}: "
1774         "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}")
1775     endif()
1776   endif()
1777   if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
1778     list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
1779     if(Boost_DEBUG)
1780       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1781         "Component-specific library search paths for ${COMPONENT}: "
1782         "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
1783     endif()
1784   endif()
1785
1786   #
1787   # Find headers
1788   #
1789   _Boost_COMPONENT_HEADERS("${COMPONENT}" Boost_${UPPERCOMPONENT}_HEADER_NAME)
1790   # Look for a standard boost header file.
1791   if(Boost_${UPPERCOMPONENT}_HEADER_NAME)
1792     if(EXISTS "${Boost_INCLUDE_DIR}/${Boost_${UPPERCOMPONENT}_HEADER_NAME}")
1793       set(Boost_${UPPERCOMPONENT}_HEADER ON)
1794     else()
1795       set(Boost_${UPPERCOMPONENT}_HEADER OFF)
1796     endif()
1797   else()
1798     set(Boost_${UPPERCOMPONENT}_HEADER ON)
1799     message(WARNING "No header defined for ${COMPONENT}; skipping header check")
1800   endif()
1801
1802   #
1803   # Find RELEASE libraries
1804   #
1805   unset(_boost_RELEASE_NAMES)
1806   foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT)
1807     foreach(compiler IN LISTS _boost_COMPILER)
1808       list(APPEND _boost_RELEASE_NAMES
1809         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1810         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1811         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
1812     endforeach()
1813     list(APPEND _boost_RELEASE_NAMES
1814       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1815       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1816       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
1817       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}
1818       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
1819     if(_boost_STATIC_RUNTIME_WORKAROUND)
1820       set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
1821       foreach(compiler IN LISTS _boost_COMPILER)
1822         list(APPEND _boost_RELEASE_NAMES
1823           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1824           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1825           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
1826       endforeach()
1827       list(APPEND _boost_RELEASE_NAMES
1828         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1829         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1830         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
1831     endif()
1832   endforeach()
1833   if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
1834     _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
1835   endif()
1836   if(Boost_DEBUG)
1837     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1838                    "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
1839   endif()
1840
1841   # if Boost_LIBRARY_DIR_RELEASE is not defined,
1842   # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
1843   if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
1844     list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
1845   endif()
1846
1847   # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
1848   string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
1849
1850   if(Boost_USE_RELEASE_LIBS)
1851     _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
1852       NAMES ${_boost_RELEASE_NAMES}
1853       HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
1854       NAMES_PER_DIR
1855       DOC "${_boost_docstring_release}"
1856       )
1857   endif()
1858
1859   #
1860   # Find DEBUG libraries
1861   #
1862   unset(_boost_DEBUG_NAMES)
1863   foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT)
1864     foreach(compiler IN LISTS _boost_COMPILER)
1865       list(APPEND _boost_DEBUG_NAMES
1866         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1867         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1868         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
1869     endforeach()
1870     list(APPEND _boost_DEBUG_NAMES
1871       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1872       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1873       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
1874       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}
1875       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
1876     if(_boost_STATIC_RUNTIME_WORKAROUND)
1877       set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
1878       foreach(compiler IN LISTS _boost_COMPILER)
1879         list(APPEND _boost_DEBUG_NAMES
1880           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1881           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1882           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
1883       endforeach()
1884       list(APPEND _boost_DEBUG_NAMES
1885         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
1886         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}
1887         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
1888     endif()
1889   endforeach()
1890   if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
1891      _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
1892   endif()
1893   if(Boost_DEBUG)
1894     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
1895                    "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
1896   endif()
1897
1898   # if Boost_LIBRARY_DIR_DEBUG is not defined,
1899   # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
1900   if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
1901     list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
1902   endif()
1903
1904   # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
1905   string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
1906
1907   if(Boost_USE_DEBUG_LIBS)
1908     _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
1909       NAMES ${_boost_DEBUG_NAMES}
1910       HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
1911       NAMES_PER_DIR
1912       DOC "${_boost_docstring_debug}"
1913       )
1914   endif ()
1915
1916   if(Boost_REALPATH)
1917     _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
1918     _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG   "${_boost_docstring_debug}"  )
1919   endif()
1920
1921   _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
1922
1923   # Check if component requires some compiler features
1924   _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES)
1925
1926 endforeach()
1927
1928 # Restore the original find library ordering
1929 if( Boost_USE_STATIC_LIBS )
1930   set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
1931 endif()
1932
1933 # ------------------------------------------------------------------------
1934 #  End finding boost libraries
1935 # ------------------------------------------------------------------------
1936
1937 set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
1938 set(Boost_LIBRARY_DIRS)
1939 if(Boost_LIBRARY_DIR_RELEASE)
1940   list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
1941 endif()
1942 if(Boost_LIBRARY_DIR_DEBUG)
1943   list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
1944 endif()
1945 if(Boost_LIBRARY_DIRS)
1946   list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
1947 endif()
1948
1949 # The above setting of Boost_FOUND was based only on the header files.
1950 # Update it for the requested component libraries.
1951 if(Boost_FOUND)
1952   # The headers were found.  Check for requested component libs.
1953   set(_boost_CHECKED_COMPONENT FALSE)
1954   set(_Boost_MISSING_COMPONENTS "")
1955   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
1956     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
1957     set(_boost_CHECKED_COMPONENT TRUE)
1958     if(NOT Boost_${UPPERCOMPONENT}_FOUND AND Boost_FIND_REQUIRED_${COMPONENT})
1959       list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
1960     endif()
1961   endforeach()
1962   if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS)
1963     # Optional indirect dependencies are not counted as missing.
1964     list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS})
1965   endif()
1966
1967   if(Boost_DEBUG)
1968     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
1969   endif()
1970
1971   if (_Boost_MISSING_COMPONENTS)
1972     set(Boost_FOUND 0)
1973     # We were unable to find some libraries, so generate a sensible
1974     # error message that lists the libraries we were unable to find.
1975     string(APPEND Boost_ERROR_REASON
1976       "\nCould not find the following")
1977     if(Boost_USE_STATIC_LIBS)
1978       string(APPEND Boost_ERROR_REASON " static")
1979     endif()
1980     string(APPEND Boost_ERROR_REASON
1981       " Boost libraries:\n")
1982     foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
1983       string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
1984       string(APPEND Boost_ERROR_REASON
1985         "        ${Boost_NAMESPACE}_${COMPONENT}${Boost_ERROR_REASON_${UPPERCOMPONENT}}\n")
1986     endforeach()
1987
1988     list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
1989     list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
1990     if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
1991       string(APPEND Boost_ERROR_REASON
1992         "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.")
1993     else ()
1994       string(APPEND Boost_ERROR_REASON
1995         "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.")
1996     endif ()
1997   endif ()
1998
1999   if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
2000     # Compatibility Code for backwards compatibility with CMake
2001     # 2.4's FindBoost module.
2002
2003     # Look for the boost library path.
2004     # Note that the user may not have installed any libraries
2005     # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
2006     set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
2007
2008     if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
2009       get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
2010     endif()
2011
2012     if("${_boost_LIB_DIR}" MATCHES "/include$")
2013       # Strip off the trailing "/include" in the path.
2014       get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
2015     endif()
2016
2017     if(EXISTS "${_boost_LIB_DIR}/lib")
2018       string(APPEND _boost_LIB_DIR /lib)
2019     elseif(EXISTS "${_boost_LIB_DIR}/stage/lib")
2020       string(APPEND _boost_LIB_DIR "/stage/lib")
2021     else()
2022       set(_boost_LIB_DIR "")
2023     endif()
2024
2025     if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
2026       set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
2027     endif()
2028
2029   endif()
2030 else()
2031   # Boost headers were not found so no components were found.
2032   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
2033     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
2034     set(Boost_${UPPERCOMPONENT}_FOUND 0)
2035   endforeach()
2036 endif()
2037
2038 # ------------------------------------------------------------------------
2039 #  Add imported targets
2040 # ------------------------------------------------------------------------
2041
2042 if(Boost_FOUND)
2043   # For header-only libraries
2044   if(NOT TARGET Boost::boost)
2045     add_library(Boost::boost INTERFACE IMPORTED)
2046     if(Boost_INCLUDE_DIRS)
2047       set_target_properties(Boost::boost PROPERTIES
2048         INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
2049     endif()
2050   endif()
2051
2052   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
2053     if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT})
2054       string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
2055       if(Boost_${UPPERCOMPONENT}_FOUND)
2056         if(Boost_USE_STATIC_LIBS)
2057           add_library(Boost::${COMPONENT} STATIC IMPORTED)
2058         else()
2059           # Even if Boost_USE_STATIC_LIBS is OFF, we might have static
2060           # libraries as a result.
2061           add_library(Boost::${COMPONENT} UNKNOWN IMPORTED)
2062         endif()
2063         if(Boost_INCLUDE_DIRS)
2064           set_target_properties(Boost::${COMPONENT} PROPERTIES
2065             INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
2066         endif()
2067         if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}")
2068           set_target_properties(Boost::${COMPONENT} PROPERTIES
2069             IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
2070             IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}")
2071         endif()
2072         if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
2073           set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
2074             IMPORTED_CONFIGURATIONS RELEASE)
2075           set_target_properties(Boost::${COMPONENT} PROPERTIES
2076             IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
2077             IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
2078         endif()
2079         if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
2080           set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
2081             IMPORTED_CONFIGURATIONS DEBUG)
2082           set_target_properties(Boost::${COMPONENT} PROPERTIES
2083             IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
2084             IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
2085         endif()
2086         if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES)
2087           unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES)
2088           foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES})
2089             list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep})
2090           endforeach()
2091           if(COMPONENT STREQUAL "thread")
2092             list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads)
2093           endif()
2094           set_target_properties(Boost::${COMPONENT} PROPERTIES
2095             INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}")
2096         endif()
2097         if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES)
2098           set_target_properties(Boost::${COMPONENT} PROPERTIES
2099             INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}")
2100         endif()
2101       endif()
2102     endif()
2103   endforeach()
2104 endif()
2105
2106 # ------------------------------------------------------------------------
2107 #  Notification to end user about what was found
2108 # ------------------------------------------------------------------------
2109
2110 set(Boost_LIBRARIES "")
2111 if(Boost_FOUND)
2112   if(NOT Boost_FIND_QUIETLY)
2113     message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
2114     if(Boost_FIND_COMPONENTS)
2115       message(STATUS "Found the following Boost libraries:")
2116     endif()
2117   endif()
2118   foreach( COMPONENT  ${Boost_FIND_COMPONENTS} )
2119     string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
2120     if( Boost_${UPPERCOMPONENT}_FOUND )
2121       if(NOT Boost_FIND_QUIETLY)
2122         message (STATUS "  ${COMPONENT}")
2123       endif()
2124       list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
2125       if(COMPONENT STREQUAL "thread")
2126         list(APPEND Boost_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
2127       endif()
2128     endif()
2129   endforeach()
2130 else()
2131   if(Boost_FIND_REQUIRED)
2132     message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
2133   else()
2134     if(NOT Boost_FIND_QUIETLY)
2135       # we opt not to automatically output Boost_ERROR_REASON here as
2136       # it could be quite lengthy and somewhat imposing in its requests
2137       # Since Boost is not always a required dependency we'll leave this
2138       # up to the end-user.
2139       if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
2140         message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
2141       else()
2142         message(STATUS "Could NOT find Boost")
2143       endif()
2144     endif()
2145   endif()
2146 endif()
2147
2148 # Configure display of cache entries in GUI.
2149 foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
2150   get_property(_type CACHE ${v} PROPERTY TYPE)
2151   if(_type)
2152     set_property(CACHE ${v} PROPERTY ADVANCED 1)
2153     if("x${_type}" STREQUAL "xUNINITIALIZED")
2154       if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
2155         set_property(CACHE ${v} PROPERTY TYPE STRING)
2156       else()
2157         set_property(CACHE ${v} PROPERTY TYPE PATH)
2158       endif()
2159     endif()
2160   endif()
2161 endforeach()
2162
2163 # Record last used values of input variables so we can
2164 # detect on the next run if the user changed them.
2165 foreach(v
2166     ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
2167     ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
2168     )
2169   if(DEFINED ${v})
2170     set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
2171   else()
2172     unset(_${v}_LAST CACHE)
2173   endif()
2174 endforeach()
2175
2176 # Maintain a persistent list of components requested anywhere since
2177 # the last flush.
2178 set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
2179 list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
2180 list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
2181 list(SORT _Boost_COMPONENTS_SEARCHED)
2182 set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
2183   CACHE INTERNAL "Components requested for this build tree.")
2184
2185 # Restore project's policies
2186 cmake_policy(POP)