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