Advertisement
Guest User

rettt

a guest
Jul 22nd, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 99.43 KB | None | 0 0
  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(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
  462.       set(_boost_COMPILER "-vc141;-vc140")
  463.     elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
  464.       set(_boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
  465.     elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10)
  466.       set(_boost_COMPILER "-vc71")
  467.     elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck!
  468.       set(_boost_COMPILER "-vc7") # yes, this is correct
  469.     else() # VS 6.0 Good luck!
  470.       set(_boost_COMPILER "-vc6") # yes, this is correct
  471.     endif()
  472.   elseif (BORLAND)
  473.     set(_boost_COMPILER "-bcb")
  474.   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
  475.     set(_boost_COMPILER "-sw")
  476.   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL")
  477.     set(_boost_COMPILER "-xlc")
  478.   elseif (MINGW)
  479.     if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  480.         set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
  481.     else()
  482.       _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  483.       set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  484.     endif()
  485.   elseif (UNIX)
  486.     if (CMAKE_COMPILER_IS_GNUCXX)
  487.       if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  488.         set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
  489.       else()
  490.         _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  491.         # Determine which version of GCC we have.
  492.         if(APPLE)
  493.           if(Boost_MINOR_VERSION)
  494.             if(${Boost_MINOR_VERSION} GREATER 35)
  495.               # In Boost 1.36.0 and newer, the mangled compiler name used
  496.               # on Mac OS X/Darwin is "xgcc".
  497.               set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
  498.             else()
  499.               # In Boost <= 1.35.0, there is no mangled compiler name for
  500.               # the Mac OS X/Darwin version of GCC.
  501.               set(_boost_COMPILER "")
  502.             endif()
  503.           else()
  504.             # We don't know the Boost version, so assume it's
  505.             # pre-1.36.0.
  506.             set(_boost_COMPILER "")
  507.           endif()
  508.         else()
  509.           set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
  510.         endif()
  511.       endif()
  512.     endif ()
  513.   else()
  514.     # TODO at least Boost_DEBUG here?
  515.     set(_boost_COMPILER "")
  516.   endif()
  517.   set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
  518. endfunction()
  519.  
  520. #
  521. # Get component dependencies.  Requires the dependencies to have been
  522. # defined for the Boost release version.
  523. #
  524. # component - the component to check
  525. # _ret - list of library dependencies
  526. #
  527. function(_Boost_COMPONENT_DEPENDENCIES component _ret)
  528.   # Note: to add a new Boost release, run
  529.   #
  530.   #   % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake
  531.   #
  532.   # The output may be added in a new block below.  If it's the same as
  533.   # the previous release, simply update the version range of the block
  534.   # for the previous release.  Also check if any new components have
  535.   # been added, and add any new components to
  536.   # _Boost_COMPONENT_HEADERS.
  537.   #
  538.   # This information was originally generated by running
  539.   # BoostScanDeps.cmake against every boost release to date supported
  540.   # by FindBoost:
  541.   #
  542.   #   % for version in /path/to/boost/sources/*
  543.   #     do
  544.   #       cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake
  545.   #     done
  546.   #
  547.   # The output was then updated by search and replace with these regexes:
  548.   #
  549.   # - Strip message(STATUS) prefix dashes
  550.   #   s;^-- ;;
  551.   # - Indent
  552.   #   s;^set(;    set(;;
  553.   # - Add conditionals
  554.   #   s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*);  elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx);
  555.   #
  556.   # This results in the logic seen below, but will require the xxxx
  557.   # replacing with the following Boost release version (or the next
  558.   # minor version to be released, e.g. 1.59 was the latest at the time
  559.   # of writing, making 1.60 the next, so 106000 is the needed version
  560.   # number).  Identical consecutive releases were then merged together
  561.   # by updating the end range of the first block and removing the
  562.   # following redundant blocks.
  563.   #
  564.   # Running the script against all historical releases should be
  565.   # required only if the BoostScanDeps.cmake script logic is changed.
  566.   # The addition of a new release should only require it to be run
  567.   # against the new release.
  568.  
  569.   # Handle Python version suffixes
  570.   if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
  571.     set(component "${CMAKE_MATCH_1}")
  572.     set(component_python_version "${CMAKE_MATCH_2}")
  573.   endif()
  574.  
  575.   set(_Boost_IMPORTED_TARGETS TRUE)
  576.   if(Boost_VERSION VERSION_LESS 103300)
  577.     message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)")
  578.     set(_Boost_IMPORTED_TARGETS FALSE)
  579.   elseif(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500)
  580.     set(_Boost_IOSTREAMS_DEPENDENCIES regex thread)
  581.     set(_Boost_REGEX_DEPENDENCIES thread)
  582.     set(_Boost_WAVE_DEPENDENCIES filesystem thread)
  583.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  584.   elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600)
  585.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  586.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  587.     set(_Boost_MPI_DEPENDENCIES serialization)
  588.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  589.     set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
  590.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  591.   elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800)
  592.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  593.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  594.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
  595.     set(_Boost_MPI_DEPENDENCIES serialization)
  596.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  597.     set(_Boost_WAVE_DEPENDENCIES filesystem system thread)
  598.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  599.   elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300)
  600.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  601.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  602.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
  603.     set(_Boost_MPI_DEPENDENCIES serialization)
  604.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  605.     set(_Boost_THREAD_DEPENDENCIES date_time)
  606.     set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
  607.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  608.   elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400)
  609.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  610.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  611.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
  612.     set(_Boost_MPI_DEPENDENCIES serialization)
  613.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  614.     set(_Boost_THREAD_DEPENDENCIES date_time)
  615.     set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time)
  616.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  617.   elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500)
  618.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  619.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  620.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization)
  621.     set(_Boost_MPI_DEPENDENCIES serialization)
  622.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  623.     set(_Boost_THREAD_DEPENDENCIES date_time)
  624.     set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time)
  625.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  626.   elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700)
  627.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  628.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  629.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random)
  630.     set(_Boost_MPI_DEPENDENCIES serialization)
  631.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  632.     set(_Boost_THREAD_DEPENDENCIES date_time)
  633.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
  634.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  635.   elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800)
  636.     set(_Boost_CHRONO_DEPENDENCIES system)
  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 104800 AND Boost_VERSION VERSION_LESS 105000)
  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_TIMER_DEPENDENCIES chrono system)
  654.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time)
  655.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  656.   elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300)
  657.     set(_Boost_CHRONO_DEPENDENCIES system)
  658.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  659.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  660.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  661.     set(_Boost_MPI_DEPENDENCIES serialization)
  662.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  663.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time)
  664.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  665.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
  666.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  667.   elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400)
  668.     set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
  669.     set(_Boost_CHRONO_DEPENDENCIES system)
  670.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  671.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  672.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  673.     set(_Boost_MPI_DEPENDENCIES serialization)
  674.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  675.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  676.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  677.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time)
  678.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  679.   elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500)
  680.     set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time)
  681.     set(_Boost_CHRONO_DEPENDENCIES system)
  682.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  683.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  684.     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
  685.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  686.     set(_Boost_MPI_DEPENDENCIES serialization)
  687.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  688.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  689.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  690.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  691.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  692.   elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600)
  693.     set(_Boost_CHRONO_DEPENDENCIES system)
  694.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  695.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  696.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  697.     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
  698.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random)
  699.     set(_Boost_MPI_DEPENDENCIES serialization)
  700.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  701.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  702.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  703.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  704.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  705.   elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900)
  706.     set(_Boost_CHRONO_DEPENDENCIES system)
  707.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  708.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  709.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  710.     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono)
  711.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  712.     set(_Boost_MPI_DEPENDENCIES serialization)
  713.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  714.     set(_Boost_RANDOM_DEPENDENCIES system)
  715.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  716.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  717.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  718.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  719.   elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000)
  720.     set(_Boost_CHRONO_DEPENDENCIES system)
  721.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  722.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  723.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  724.     set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic)
  725.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  726.     set(_Boost_MPI_DEPENDENCIES serialization)
  727.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  728.     set(_Boost_RANDOM_DEPENDENCIES system)
  729.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  730.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  731.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  732.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  733.   elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100)
  734.     set(_Boost_CHRONO_DEPENDENCIES system)
  735.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  736.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  737.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  738.     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  739.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  740.     set(_Boost_MPI_DEPENDENCIES serialization)
  741.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  742.     set(_Boost_RANDOM_DEPENDENCIES system)
  743.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  744.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  745.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  746.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  747.   elseif(NOT Boost_VERSION VERSION_LESS 106100 AND Boost_VERSION VERSION_LESS 106200)
  748.     set(_Boost_CHRONO_DEPENDENCIES system)
  749.     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
  750.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  751.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  752.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  753.     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  754.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  755.     set(_Boost_MPI_DEPENDENCIES serialization)
  756.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  757.     set(_Boost_RANDOM_DEPENDENCIES system)
  758.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  759.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  760.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  761.   elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300)
  762.     set(_Boost_CHRONO_DEPENDENCIES system)
  763.     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
  764.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  765.     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
  766.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  767.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  768.     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  769.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  770.     set(_Boost_MPI_DEPENDENCIES serialization)
  771.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  772.     set(_Boost_RANDOM_DEPENDENCIES system)
  773.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  774.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  775.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  776.   elseif(NOT Boost_VERSION VERSION_LESS 106300 AND Boost_VERSION VERSION_LESS 106500)
  777.     set(_Boost_CHRONO_DEPENDENCIES system)
  778.     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
  779.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  780.     set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time)
  781.     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
  782.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  783.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  784.     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  785.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  786.     set(_Boost_MPI_DEPENDENCIES serialization)
  787.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  788.     set(_Boost_RANDOM_DEPENDENCIES system)
  789.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  790.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  791.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  792.   elseif(NOT Boost_VERSION VERSION_LESS 106500 AND Boost_VERSION VERSION_LESS 106700)
  793.     set(_Boost_CHRONO_DEPENDENCIES system)
  794.     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
  795.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  796.     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
  797.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  798.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  799.     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  800.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  801.     set(_Boost_MPI_DEPENDENCIES serialization)
  802.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  803.     set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
  804.     set(_Boost_RANDOM_DEPENDENCIES system)
  805.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  806.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  807.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  808.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  809.   elseif(NOT Boost_VERSION VERSION_LESS 106700 AND Boost_VERSION VERSION_LESS 106800)
  810.     set(_Boost_CHRONO_DEPENDENCIES system)
  811.     set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
  812.     set(_Boost_COROUTINE_DEPENDENCIES context system)
  813.     set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
  814.     set(_Boost_FILESYSTEM_DEPENDENCIES system)
  815.     set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  816.     set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  817.     set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  818.     set(_Boost_MPI_DEPENDENCIES serialization)
  819.     set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  820.     set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
  821.     set(_Boost_RANDOM_DEPENDENCIES system)
  822.     set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  823.     set(_Boost_TIMER_DEPENDENCIES chrono system)
  824.     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  825.     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  826.   else()
  827.     if(NOT Boost_VERSION VERSION_LESS 106800)
  828.       set(_Boost_CHRONO_DEPENDENCIES system)
  829.       set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
  830.       set(_Boost_CONTRACT_DEPENDENCIES thread chrono system date_time)
  831.       set(_Boost_COROUTINE_DEPENDENCIES context system)
  832.       set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
  833.       set(_Boost_FILESYSTEM_DEPENDENCIES system)
  834.       set(_Boost_IOSTREAMS_DEPENDENCIES regex)
  835.       set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
  836.       set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
  837.       set(_Boost_MPI_DEPENDENCIES serialization)
  838.       set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
  839.       set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
  840.       set(_Boost_RANDOM_DEPENDENCIES system)
  841.       set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
  842.       set(_Boost_TIMER_DEPENDENCIES chrono system)
  843.       set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
  844.       set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
  845.     endif()
  846.     if(NOT Boost_VERSION VERSION_LESS 106900)
  847.       message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
  848.     endif()
  849.   endif()
  850.  
  851.   string(TOUPPER ${component} uppercomponent)
  852.   set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  853.   set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
  854.  
  855.   string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}")
  856.   if (NOT _boost_DEPS_STRING)
  857.     set(_boost_DEPS_STRING "(none)")
  858.   endif()
  859.   # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}")
  860. endfunction()
  861.  
  862. #
  863. # Get component headers.  This is the primary header (or headers) for
  864. # a given component, and is used to check that the headers are present
  865. # as well as the library itself as an extra sanity check of the build
  866. # environment.
  867. #
  868. # component - the component to check
  869. # _hdrs
  870. #
  871. function(_Boost_COMPONENT_HEADERS component _hdrs)
  872.   # Handle Python version suffixes
  873.   if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$")
  874.     set(component "${CMAKE_MATCH_1}")
  875.     set(component_python_version "${CMAKE_MATCH_2}")
  876.   endif()
  877.  
  878.   # Note: new boost components will require adding here.  The header
  879.   # must be present in all versions of Boost providing a library.
  880.   set(_Boost_ATOMIC_HEADERS              "boost/atomic.hpp")
  881.   set(_Boost_CHRONO_HEADERS              "boost/chrono.hpp")
  882.   set(_Boost_CONTAINER_HEADERS           "boost/container/container_fwd.hpp")
  883.   set(_Boost_CONTRACT_HEADERS            "boost/contract.hpp")
  884.   set(_Boost_CONTEXT_HEADERS             "boost/context/detail/fcontext.hpp")
  885.   set(_Boost_COROUTINE_HEADERS           "boost/coroutine/all.hpp")
  886.   set(_Boost_DATE_TIME_HEADERS           "boost/date_time/date.hpp")
  887.   set(_Boost_EXCEPTION_HEADERS           "boost/exception/exception.hpp")
  888.   set(_Boost_FIBER_HEADERS               "boost/fiber/all.hpp")
  889.   set(_Boost_FILESYSTEM_HEADERS          "boost/filesystem/path.hpp")
  890.   set(_Boost_GRAPH_HEADERS               "boost/graph/adjacency_list.hpp")
  891.   set(_Boost_GRAPH_PARALLEL_HEADERS      "boost/graph/adjacency_list.hpp")
  892.   set(_Boost_IOSTREAMS_HEADERS           "boost/iostreams/stream.hpp")
  893.   set(_Boost_LOCALE_HEADERS              "boost/locale.hpp")
  894.   set(_Boost_LOG_HEADERS                 "boost/log/core.hpp")
  895.   set(_Boost_LOG_SETUP_HEADERS           "boost/log/detail/setup_config.hpp")
  896.   set(_Boost_MATH_HEADERS                "boost/math_fwd.hpp")
  897.   set(_Boost_MATH_C99_HEADERS            "boost/math/tr1.hpp")
  898.   set(_Boost_MATH_C99F_HEADERS           "boost/math/tr1.hpp")
  899.   set(_Boost_MATH_C99L_HEADERS           "boost/math/tr1.hpp")
  900.   set(_Boost_MATH_TR1_HEADERS            "boost/math/tr1.hpp")
  901.   set(_Boost_MATH_TR1F_HEADERS           "boost/math/tr1.hpp")
  902.   set(_Boost_MATH_TR1L_HEADERS           "boost/math/tr1.hpp")
  903.   set(_Boost_MPI_HEADERS                 "boost/mpi.hpp")
  904.   set(_Boost_MPI_PYTHON_HEADERS          "boost/mpi/python/config.hpp")
  905.   set(_Boost_NUMPY_HEADERS               "boost/python/numpy.hpp")
  906.   set(_Boost_PRG_EXEC_MONITOR_HEADERS    "boost/test/prg_exec_monitor.hpp")
  907.   set(_Boost_PROGRAM_OPTIONS_HEADERS     "boost/program_options.hpp")
  908.   set(_Boost_PYTHON_HEADERS              "boost/python.hpp")
  909.   set(_Boost_RANDOM_HEADERS              "boost/random.hpp")
  910.   set(_Boost_REGEX_HEADERS               "boost/regex.hpp")
  911.   set(_Boost_SERIALIZATION_HEADERS       "boost/serialization/serialization.hpp")
  912.   set(_Boost_SIGNALS_HEADERS             "boost/signals.hpp")
  913.   set(_Boost_SYSTEM_HEADERS              "boost/system/config.hpp")
  914.   set(_Boost_TEST_EXEC_MONITOR_HEADERS   "boost/test/test_exec_monitor.hpp")
  915.   set(_Boost_THREAD_HEADERS              "boost/thread.hpp")
  916.   set(_Boost_TIMER_HEADERS               "boost/timer.hpp")
  917.   set(_Boost_TYPE_ERASURE_HEADERS        "boost/type_erasure/config.hpp")
  918.   set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp")
  919.   set(_Boost_WAVE_HEADERS                "boost/wave.hpp")
  920.   set(_Boost_WSERIALIZATION_HEADERS      "boost/archive/text_wiarchive.hpp")
  921.   if(WIN32)
  922.     set(_Boost_BZIP2_HEADERS             "boost/iostreams/filter/bzip2.hpp")
  923.     set(_Boost_ZLIB_HEADERS              "boost/iostreams/filter/zlib.hpp")
  924.   endif()
  925.  
  926.   string(TOUPPER ${component} uppercomponent)
  927.   set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE)
  928.  
  929.   string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}")
  930.   if (NOT _boost_HDRS_STRING)
  931.     set(_boost_HDRS_STRING "(none)")
  932.   endif()
  933.   # message(STATUS "Headers for Boost::${component}: ${_boost_HDRS_STRING}")
  934. endfunction()
  935.  
  936. #
  937. # Determine if any missing dependencies require adding to the component list.
  938. #
  939. # Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component,
  940. # plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be
  941. # defined; FALSE if dependency information is unavailable).
  942. #
  943. # componentvar - the component list variable name
  944. # extravar - the indirect dependency list variable name
  945. #
  946. #
  947. function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
  948.   # _boost_unprocessed_components - list of components requiring processing
  949.   # _boost_processed_components - components already processed (or currently being processed)
  950.   # _boost_new_components - new components discovered for future processing
  951.   #
  952.   list(APPEND _boost_unprocessed_components ${${componentvar}})
  953.  
  954.   while(_boost_unprocessed_components)
  955.     list(APPEND _boost_processed_components ${_boost_unprocessed_components})
  956.     foreach(component ${_boost_unprocessed_components})
  957.       string(TOUPPER ${component} uppercomponent)
  958.       set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  959.       _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES)
  960.       set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
  961.       set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
  962.       foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
  963.         if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components))
  964.           list(APPEND _boost_new_components ${componentdep})
  965.         endif()
  966.       endforeach()
  967.     endforeach()
  968.     set(_boost_unprocessed_components ${_boost_new_components})
  969.     unset(_boost_new_components)
  970.   endwhile()
  971.   set(_boost_extra_components ${_boost_processed_components})
  972.   if(_boost_extra_components AND ${componentvar})
  973.     list(REMOVE_ITEM _boost_extra_components ${${componentvar}})
  974.   endif()
  975.   set(${componentvar} ${_boost_processed_components} PARENT_SCOPE)
  976.   set(${extravar} ${_boost_extra_components} PARENT_SCOPE)
  977. endfunction()
  978.  
  979. #
  980. # Some boost libraries may require particular set of compler features.
  981. # The very first one was `boost::fiber` introduced in Boost 1.62.
  982. # One can check required compiler features of it in
  983. # `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`.
  984. #
  985. function(_Boost_COMPILER_FEATURES component _ret)
  986.   # Boost >= 1.62 and < 1.67
  987.   if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106700)
  988.     set(_Boost_FIBER_COMPILER_FEATURES
  989.         cxx_alias_templates
  990.         cxx_auto_type
  991.         cxx_constexpr
  992.         cxx_defaulted_functions
  993.         cxx_final
  994.         cxx_lambdas
  995.         cxx_noexcept
  996.         cxx_nullptr
  997.         cxx_rvalue_references
  998.         cxx_thread_local
  999.         cxx_variadic_templates
  1000.     )
  1001.   endif()
  1002.   string(TOUPPER ${component} uppercomponent)
  1003.   set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE)
  1004. endfunction()
  1005.  
  1006. #
  1007. # Update library search directory hint variable with paths used by prebuilt boost binaries.
  1008. #
  1009. # Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/)
  1010. # have library directories named using MSVC compiler version and architecture.
  1011. # This function would append corresponding directories if MSVC is a current compiler,
  1012. # so having `BOOST_ROOT` would be enough to specify to find everything.
  1013. #
  1014. function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir)
  1015.   if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
  1016.     if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  1017.       set(_arch_suffix 64)
  1018.     else()
  1019.       set(_arch_suffix 32)
  1020.     endif()
  1021.     if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
  1022.       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1)
  1023.       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0)
  1024.     elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
  1025.       math(EXPR _toolset_major_version "${MSVC_TOOLSET_VERSION} / 10")
  1026.       list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-${_toolset_major_version}.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.68.0" "1.68" "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. #TODO: fix this when CMake is updated
  1509. #======================
  1510. #Systematically build up the Boost architecture and address model tag
  1511. # http://www.boost.org/doc/libs/1_66_0/more/getting_started/windows.html#library-naming
  1512. set( _boost_AAM_TAG "-x")
  1513. # Key       Use this library when:
  1514. #  32       32-bit address model
  1515. #  64       64-bit address model
  1516. if(PLATFORM EQUAL 64)
  1517. set( _boost_AAM_TAG "${_boost_AAM_TAG}64")
  1518. else()
  1519. set( _boost_AAM_TAG "${_boost_AAM_TAG}32")
  1520. endif()
  1521.  
  1522. if(Boost_DEBUG)
  1523.    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1524.    "_boost_AAM_TAG = ${_boost_AAM_TAG}")
  1525.    endif()
  1526.    
  1527. # ------------------------------------------------------------------------
  1528. #  Begin finding boost libraries
  1529. # ------------------------------------------------------------------------
  1530.  
  1531. set(_Boost_VARS_LIB "")
  1532. foreach(c DEBUG RELEASE)
  1533.   set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
  1534.   list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
  1535.   _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
  1536.   # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
  1537.   # location did.  We will find a new one based on the new inputs.
  1538.   if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
  1539.     unset(Boost_LIBRARY_DIR_${c} CACHE)
  1540.   endif()
  1541.  
  1542.   # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
  1543.   if(Boost_LIBRARY_DIR_${c})
  1544.     set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  1545.   else()
  1546.     set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
  1547.     if(BOOST_LIBRARYDIR)
  1548.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
  1549.     elseif(_ENV_BOOST_LIBRARYDIR)
  1550.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
  1551.     endif()
  1552.  
  1553.     if(BOOST_ROOT)
  1554.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
  1555.       _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}")
  1556.     elseif(_ENV_BOOST_ROOT)
  1557.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
  1558.       _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}")
  1559.     endif()
  1560.  
  1561.     list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
  1562.       ${Boost_INCLUDE_DIR}/lib
  1563.       ${Boost_INCLUDE_DIR}/../lib
  1564.       ${Boost_INCLUDE_DIR}/stage/lib
  1565.       )
  1566.     _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..")
  1567.     _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}")
  1568.     if( Boost_NO_SYSTEM_PATHS )
  1569.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH)
  1570.     else()
  1571.       foreach(ver ${_Boost_KNOWN_VERSIONS})
  1572.         string(REPLACE "." "_" ver "${ver}")
  1573.         _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}")
  1574.       endforeach()
  1575.       _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost")
  1576.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
  1577.         C:/boost/lib
  1578.         C:/boost
  1579.         /sw/local/lib
  1580.         )
  1581.     endif()
  1582.   endif()
  1583. endforeach()
  1584.  
  1585. if(Boost_DEBUG)
  1586.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1587.     "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
  1588.     "_boost_LIBRARY_SEARCH_DIRS_DEBUG   = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1589. endif()
  1590.  
  1591. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  1592. if( Boost_USE_STATIC_LIBS )
  1593.   set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  1594.   if(WIN32)
  1595.     list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a)
  1596.   else()
  1597.     set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
  1598.   endif()
  1599. endif()
  1600.  
  1601. # We want to use the tag inline below without risking double dashes
  1602. if(_boost_RELEASE_ABI_TAG)
  1603.   if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
  1604.     set(_boost_RELEASE_ABI_TAG "")
  1605.   endif()
  1606. endif()
  1607. if(_boost_DEBUG_ABI_TAG)
  1608.   if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
  1609.     set(_boost_DEBUG_ABI_TAG "")
  1610.   endif()
  1611. endif()
  1612.  
  1613. # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
  1614. # on WIN32 was to:
  1615. #  1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
  1616. #  2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
  1617. # We maintain this behavior since changing it could break people's builds.
  1618. # To disable the ambiguous behavior, the user need only
  1619. # set Boost_USE_STATIC_RUNTIME either ON or OFF.
  1620. set(_boost_STATIC_RUNTIME_WORKAROUND false)
  1621. if(WIN32 AND Boost_USE_STATIC_LIBS)
  1622.   if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
  1623.     set(_boost_STATIC_RUNTIME_WORKAROUND TRUE)
  1624.   endif()
  1625. endif()
  1626.  
  1627. # On versions < 1.35, remove the System library from the considered list
  1628. # since it wasn't added until 1.35.
  1629. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  1630.    if(Boost_VERSION LESS 103500)
  1631.      list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  1632.    endif()
  1633. endif()
  1634.  
  1635. # Additional components may be required via component dependencies.
  1636. # Add any missing components to the list.
  1637. _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS)
  1638.  
  1639. # If thread is required, get the thread libs as a dependency
  1640. if("thread" IN_LIST Boost_FIND_COMPONENTS)
  1641.   if(Boost_FIND_QUIETLY)
  1642.     set(_Boost_find_quiet QUIET)
  1643.   else()
  1644.     set(_Boost_find_quiet "")
  1645.   endif()
  1646.   find_package(Threads ${_Boost_find_quiet})
  1647.   unset(_Boost_find_quiet)
  1648. endif()
  1649.  
  1650. # If the user changed any of our control inputs flush previous results.
  1651. if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME)
  1652.   foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
  1653.     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1654.     foreach(c DEBUG RELEASE)
  1655.       set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
  1656.       unset(${_var} CACHE)
  1657.       set(${_var} "${_var}-NOTFOUND")
  1658.     endforeach()
  1659.   endforeach()
  1660.   set(_Boost_COMPONENTS_SEARCHED "")
  1661. endif()
  1662.  
  1663. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1664.   string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1665.  
  1666.   set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
  1667.   set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
  1668.  
  1669.   # Compute component-specific hints.
  1670.   set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
  1671.   if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
  1672.      ${COMPONENT} STREQUAL "graph_parallel")
  1673.     foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
  1674.       if(IS_ABSOLUTE "${lib}")
  1675.         get_filename_component(libdir "${lib}" PATH)
  1676.         string(REPLACE "\\" "/" libdir "${libdir}")
  1677.         list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
  1678.       endif()
  1679.     endforeach()
  1680.   endif()
  1681.  
  1682.   # Handle Python version suffixes
  1683.   unset(COMPONENT_PYTHON_VERSION_MAJOR)
  1684.   unset(COMPONENT_PYTHON_VERSION_MINOR)
  1685.   if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$")
  1686.     set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
  1687.     set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
  1688.   elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$")
  1689.     set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}")
  1690.     set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}")
  1691.     set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}")
  1692.   endif()
  1693.  
  1694.   unset(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
  1695.   if (COMPONENT_PYTHON_VERSION_MINOR)
  1696.     # Boost >= 1.67
  1697.     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
  1698.     # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix)
  1699.     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
  1700.     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
  1701.     # Gentoo
  1702.     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
  1703.     # RPMs
  1704.     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}")
  1705.   endif()
  1706.   if (COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR)
  1707.     # Boost < 1.67
  1708.     list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}")
  1709.   endif()
  1710.  
  1711.   # Consolidate and report component-specific hints.
  1712.   if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
  1713.     list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME)
  1714.     if(Boost_DEBUG)
  1715.       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1716.         "Component-specific library search names for ${COMPONENT_NAME}: "
  1717.         "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}")
  1718.     endif()
  1719.   endif()
  1720.   if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1721.     list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1722.     if(Boost_DEBUG)
  1723.       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1724.         "Component-specific library search paths for ${COMPONENT}: "
  1725.         "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
  1726.     endif()
  1727.   endif()
  1728.  
  1729.   #
  1730.   # Find headers
  1731.   #
  1732.   _Boost_COMPONENT_HEADERS("${COMPONENT}" Boost_${UPPERCOMPONENT}_HEADER_NAME)
  1733.   # Look for a standard boost header file.
  1734.   if(Boost_${UPPERCOMPONENT}_HEADER_NAME)
  1735.     if(EXISTS "${Boost_INCLUDE_DIR}/${Boost_${UPPERCOMPONENT}_HEADER_NAME}")
  1736.       set(Boost_${UPPERCOMPONENT}_HEADER ON)
  1737.     else()
  1738.       set(Boost_${UPPERCOMPONENT}_HEADER OFF)
  1739.     endif()
  1740.   else()
  1741.     set(Boost_${UPPERCOMPONENT}_HEADER ON)
  1742.     message(WARNING "No header defined for ${COMPONENT}; skipping header check")
  1743.   endif()
  1744.  
  1745.   #
  1746.   # Find RELEASE libraries
  1747.   #
  1748.   unset(_boost_RELEASE_NAMES)
  1749.   foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT)
  1750.     foreach(compiler IN LISTS _boost_COMPILER)
  1751.       list(APPEND _boost_RELEASE_NAMES
  1752.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1753.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1754.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} )
  1755.     endforeach()
  1756.     list(APPEND _boost_RELEASE_NAMES
  1757.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1758.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1759.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1760.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
  1761.     if(_boost_STATIC_RUNTIME_WORKAROUND)
  1762.       set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
  1763.       foreach(compiler IN LISTS _boost_COMPILER)
  1764.         list(APPEND _boost_RELEASE_NAMES
  1765.           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1766.           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1767.           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  1768.       endforeach()
  1769.       list(APPEND _boost_RELEASE_NAMES
  1770.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1771.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1772.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  1773.     endif()
  1774.   endforeach()
  1775.   if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1776.     _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
  1777.   endif()
  1778.   if(Boost_DEBUG)
  1779.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1780.                    "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
  1781.   endif()
  1782.  
  1783.   # if Boost_LIBRARY_DIR_RELEASE is not defined,
  1784.   # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
  1785.   if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
  1786.     list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
  1787.   endif()
  1788.  
  1789.   # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1790.   string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
  1791.  
  1792.   if(Boost_USE_RELEASE_LIBS)
  1793.     _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
  1794.       NAMES ${_boost_RELEASE_NAMES}
  1795.       HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1796.       NAMES_PER_DIR
  1797.       DOC "${_boost_docstring_release}"
  1798.       )
  1799.   endif()
  1800.  
  1801.   #
  1802.   # Find DEBUG libraries
  1803.   #
  1804.   unset(_boost_DEBUG_NAMES)
  1805.   foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT)
  1806.     foreach(compiler IN LISTS _boost_COMPILER)
  1807.       list(APPEND _boost_DEBUG_NAMES
  1808.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1809.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1810.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} )
  1811.     endforeach()
  1812.     list(APPEND _boost_DEBUG_NAMES
  1813.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1814.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1815.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1816.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}
  1817.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} )
  1818.     if(_boost_STATIC_RUNTIME_WORKAROUND)
  1819.       set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
  1820.       foreach(compiler IN LISTS _boost_COMPILER)
  1821.         list(APPEND _boost_DEBUG_NAMES
  1822.           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1823.           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1824.           ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  1825.       endforeach()
  1826.       list(APPEND _boost_DEBUG_NAMES
  1827.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_AAM_TAG}-${Boost_LIB_VERSION}
  1828.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION}
  1829.         ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  1830.     endif()
  1831.   endforeach()
  1832.   if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1833.      _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
  1834.   endif()
  1835.   if(Boost_DEBUG)
  1836.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1837.                    "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
  1838.   endif()
  1839.  
  1840.   # if Boost_LIBRARY_DIR_DEBUG is not defined,
  1841.   # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
  1842.   if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
  1843.     list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
  1844.   endif()
  1845.  
  1846.   # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1847.   string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1848.  
  1849.   if(Boost_USE_DEBUG_LIBS)
  1850.     _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
  1851.       NAMES ${_boost_DEBUG_NAMES}
  1852.       HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1853.       NAMES_PER_DIR
  1854.       DOC "${_boost_docstring_debug}"
  1855.       )
  1856.   endif ()
  1857.  
  1858.   if(Boost_REALPATH)
  1859.     _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
  1860.     _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG   "${_boost_docstring_debug}"  )
  1861.   endif()
  1862.  
  1863.   _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  1864.  
  1865.   # Check if component requires some compiler features
  1866.   _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES)
  1867.  
  1868. endforeach()
  1869.  
  1870. # Restore the original find library ordering
  1871. if( Boost_USE_STATIC_LIBS )
  1872.   set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1873. endif()
  1874.  
  1875. # ------------------------------------------------------------------------
  1876. #  End finding boost libraries
  1877. # ------------------------------------------------------------------------
  1878.  
  1879. set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  1880. set(Boost_LIBRARY_DIRS)
  1881. if(Boost_LIBRARY_DIR_RELEASE)
  1882.   list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
  1883. endif()
  1884. if(Boost_LIBRARY_DIR_DEBUG)
  1885.   list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
  1886. endif()
  1887. if(Boost_LIBRARY_DIRS)
  1888.   list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  1889. endif()
  1890.  
  1891. # The above setting of Boost_FOUND was based only on the header files.
  1892. # Update it for the requested component libraries.
  1893. if(Boost_FOUND)
  1894.   # The headers were found.  Check for requested component libs.
  1895.   set(_boost_CHECKED_COMPONENT FALSE)
  1896.   set(_Boost_MISSING_COMPONENTS "")
  1897.   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1898.     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1899.     set(_boost_CHECKED_COMPONENT TRUE)
  1900.     if(NOT Boost_${UPPERCOMPONENT}_FOUND AND Boost_FIND_REQUIRED_${COMPONENT})
  1901.       list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  1902.     endif()
  1903.   endforeach()
  1904.   if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS)
  1905.     # Optional indirect dependencies are not counted as missing.
  1906.     list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS})
  1907.   endif()
  1908.  
  1909.   if(Boost_DEBUG)
  1910.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  1911.   endif()
  1912.  
  1913.   if (_Boost_MISSING_COMPONENTS)
  1914.     set(Boost_FOUND 0)
  1915.     # We were unable to find some libraries, so generate a sensible
  1916.     # error message that lists the libraries we were unable to find.
  1917.     string(APPEND Boost_ERROR_REASON
  1918.       "\nCould not find the following")
  1919.     if(Boost_USE_STATIC_LIBS)
  1920.       string(APPEND Boost_ERROR_REASON " static")
  1921.     endif()
  1922.     string(APPEND Boost_ERROR_REASON
  1923.       " Boost libraries:\n")
  1924.     foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  1925.       string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1926.       string(APPEND Boost_ERROR_REASON
  1927.         "        ${Boost_NAMESPACE}_${COMPONENT}${Boost_ERROR_REASON_${UPPERCOMPONENT}}\n")
  1928.     endforeach()
  1929.  
  1930.     list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  1931.     list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  1932.     if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  1933.       string(APPEND Boost_ERROR_REASON
  1934.         "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.")
  1935.     else ()
  1936.       string(APPEND Boost_ERROR_REASON
  1937.         "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.")
  1938.     endif ()
  1939.   endif ()
  1940.  
  1941.   if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  1942.     # Compatibility Code for backwards compatibility with CMake
  1943.     # 2.4's FindBoost module.
  1944.  
  1945.     # Look for the boost library path.
  1946.     # Note that the user may not have installed any libraries
  1947.     # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
  1948.     set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  1949.  
  1950.     if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  1951.       get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1952.     endif()
  1953.  
  1954.     if("${_boost_LIB_DIR}" MATCHES "/include$")
  1955.       # Strip off the trailing "/include" in the path.
  1956.       get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1957.     endif()
  1958.  
  1959.     if(EXISTS "${_boost_LIB_DIR}/lib")
  1960.       string(APPEND _boost_LIB_DIR /lib)
  1961.     elseif(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1962.       string(APPEND _boost_LIB_DIR "/stage/lib")
  1963.     else()
  1964.       set(_boost_LIB_DIR "")
  1965.     endif()
  1966.  
  1967.     if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1968.       set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
  1969.     endif()
  1970.  
  1971.   endif()
  1972. else()
  1973.   # Boost headers were not found so no components were found.
  1974.   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1975.     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1976.     set(Boost_${UPPERCOMPONENT}_FOUND 0)
  1977.   endforeach()
  1978. endif()
  1979.  
  1980. # ------------------------------------------------------------------------
  1981. #  Add imported targets
  1982. # ------------------------------------------------------------------------
  1983.  
  1984. if(Boost_FOUND)
  1985.   # For header-only libraries
  1986.   if(NOT TARGET Boost::boost)
  1987.     add_library(Boost::boost INTERFACE IMPORTED)
  1988.     if(Boost_INCLUDE_DIRS)
  1989.       set_target_properties(Boost::boost PROPERTIES
  1990.         INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
  1991.     endif()
  1992.   endif()
  1993.  
  1994.   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1995.     if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT})
  1996.       string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1997.       if(Boost_${UPPERCOMPONENT}_FOUND)
  1998.         if(Boost_USE_STATIC_LIBS)
  1999.           add_library(Boost::${COMPONENT} STATIC IMPORTED)
  2000.         else()
  2001.           # Even if Boost_USE_STATIC_LIBS is OFF, we might have static
  2002.           # libraries as a result.
  2003.           add_library(Boost::${COMPONENT} UNKNOWN IMPORTED)
  2004.         endif()
  2005.         if(Boost_INCLUDE_DIRS)
  2006.           set_target_properties(Boost::${COMPONENT} PROPERTIES
  2007.             INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}")
  2008.         endif()
  2009.         if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}")
  2010.           set_target_properties(Boost::${COMPONENT} PROPERTIES
  2011.             IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
  2012.             IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}")
  2013.         endif()
  2014.         if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
  2015.           set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
  2016.             IMPORTED_CONFIGURATIONS RELEASE)
  2017.           set_target_properties(Boost::${COMPONENT} PROPERTIES
  2018.             IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  2019.             IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}")
  2020.         endif()
  2021.         if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
  2022.           set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY
  2023.             IMPORTED_CONFIGURATIONS DEBUG)
  2024.           set_target_properties(Boost::${COMPONENT} PROPERTIES
  2025.             IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
  2026.             IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}")
  2027.         endif()
  2028.         if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES)
  2029.           unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES)
  2030.           foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES})
  2031.             list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep})
  2032.           endforeach()
  2033.           if(COMPONENT STREQUAL "thread")
  2034.             list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads)
  2035.           endif()
  2036.           set_target_properties(Boost::${COMPONENT} PROPERTIES
  2037.             INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}")
  2038.         endif()
  2039.         if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES)
  2040.           set_target_properties(Boost::${COMPONENT} PROPERTIES
  2041.             INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}")
  2042.         endif()
  2043.       endif()
  2044.     endif()
  2045.   endforeach()
  2046. endif()
  2047.  
  2048. # ------------------------------------------------------------------------
  2049. #  Notification to end user about what was found
  2050. # ------------------------------------------------------------------------
  2051.  
  2052. set(Boost_LIBRARIES "")
  2053. if(Boost_FOUND)
  2054.   if(NOT Boost_FIND_QUIETLY)
  2055.     message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  2056.     if(Boost_FIND_COMPONENTS)
  2057.       message(STATUS "Found the following Boost libraries:")
  2058.     endif()
  2059.   endif()
  2060.   foreach( COMPONENT  ${Boost_FIND_COMPONENTS} )
  2061.     string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  2062.     if( Boost_${UPPERCOMPONENT}_FOUND )
  2063.       if(NOT Boost_FIND_QUIETLY)
  2064.         message (STATUS "  ${COMPONENT}")
  2065.       endif()
  2066.       list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
  2067.     endif()
  2068.   endforeach()
  2069. else()
  2070.   if(Boost_FIND_REQUIRED)
  2071.     message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  2072.   else()
  2073.     if(NOT Boost_FIND_QUIETLY)
  2074.       # we opt not to automatically output Boost_ERROR_REASON here as
  2075.       # it could be quite lengthy and somewhat imposing in its requests
  2076.       # Since Boost is not always a required dependency we'll leave this
  2077.       # up to the end-user.
  2078.       if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
  2079.         message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
  2080.       else()
  2081.         message(STATUS "Could NOT find Boost")
  2082.       endif()
  2083.     endif()
  2084.   endif()
  2085. endif()
  2086.  
  2087. # Configure display of cache entries in GUI.
  2088. foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
  2089.   get_property(_type CACHE ${v} PROPERTY TYPE)
  2090.   if(_type)
  2091.     set_property(CACHE ${v} PROPERTY ADVANCED 1)
  2092.     if("x${_type}" STREQUAL "xUNINITIALIZED")
  2093.       if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
  2094.         set_property(CACHE ${v} PROPERTY TYPE STRING)
  2095.       else()
  2096.         set_property(CACHE ${v} PROPERTY TYPE PATH)
  2097.       endif()
  2098.     endif()
  2099.   endif()
  2100. endforeach()
  2101.  
  2102. # Record last used values of input variables so we can
  2103. # detect on the next run if the user changed them.
  2104. foreach(v
  2105.     ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
  2106.     ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
  2107.     )
  2108.   if(DEFINED ${v})
  2109.     set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
  2110.   else()
  2111.     unset(_${v}_LAST CACHE)
  2112.   endif()
  2113. endforeach()
  2114.  
  2115. # Maintain a persistent list of components requested anywhere since
  2116. # the last flush.
  2117. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
  2118. list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
  2119. list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
  2120. list(SORT _Boost_COMPONENTS_SEARCHED)
  2121. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
  2122.   CACHE INTERNAL "Components requested for this build tree.")
  2123.  
  2124. # Restore project's policies
  2125. cmake_policy(POP)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement