Advertisement
Guest User

jani

a guest
Dec 9th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 54.12 KB | None | 0 0
  1. #.rst:
  2. # FindBoost
  3. # ---------
  4. #
  5. # Find Boost include dirs and libraries
  6. #
  7. # Use this module by invoking find_package with the form::
  8. #
  9. #   find_package(Boost
  10. #     [version] [EXACT]      # Minimum or EXACT version e.g. 1.36.0
  11. #     [REQUIRED]             # Fail with error if Boost is not found
  12. #     [COMPONENTS <libs>...] # Boost libraries by their canonical name
  13. #     )                      # e.g. "date_time" for "libboost_date_time"
  14. #
  15. # This module finds headers and requested component libraries OR a CMake
  16. # package configuration file provided by a "Boost CMake" build.  For the
  17. # latter case skip to the "Boost CMake" section below.  For the former
  18. # case results are reported in variables::
  19. #
  20. #   Boost_FOUND            - True if headers and requested libraries were found
  21. #   Boost_INCLUDE_DIRS     - Boost include directories
  22. #   Boost_LIBRARY_DIRS     - Link directories for Boost libraries
  23. #   Boost_LIBRARIES        - Boost component libraries to be linked
  24. #   Boost_<C>_FOUND        - True if component <C> was found (<C> is upper-case)
  25. #   Boost_<C>_LIBRARY      - Libraries to link for component <C> (may include
  26. #                            target_link_libraries debug/optimized keywords)
  27. #   Boost_VERSION          - BOOST_VERSION value from boost/version.hpp
  28. #   Boost_LIB_VERSION      - Version string appended to library filenames
  29. #   Boost_MAJOR_VERSION    - Boost major version number (X in X.y.z)
  30. #   Boost_MINOR_VERSION    - Boost minor version number (Y in x.Y.z)
  31. #   Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
  32. #   Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
  33. #                          - Pass to add_definitions() to have diagnostic
  34. #                            information about Boost's automatic linking
  35. #                            displayed during compilation
  36. #
  37. # This module reads hints about search locations from variables::
  38. #
  39. #   BOOST_ROOT             - Preferred installation prefix
  40. #    (or BOOSTROOT)
  41. #   BOOST_INCLUDEDIR       - Preferred include directory e.g. <prefix>/include
  42. #   BOOST_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
  43. #   Boost_NO_SYSTEM_PATHS  - Set to ON to disable searching in locations not
  44. #                            specified by these hint variables. Default is OFF.
  45. #   Boost_ADDITIONAL_VERSIONS
  46. #                          - List of Boost versions not known to this module
  47. #                            (Boost install locations may contain the version)
  48. #
  49. # and saves search results persistently in CMake cache entries::
  50. #
  51. #   Boost_INCLUDE_DIR         - Directory containing Boost headers
  52. #   Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries
  53. #   Boost_LIBRARY_DIR_DEBUG   - Directory containing debug Boost libraries
  54. #   Boost_<C>_LIBRARY_DEBUG   - Component <C> library debug variant
  55. #   Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
  56. #
  57. # Users may set these hints or results as cache entries.  Projects
  58. # should not read these entries directly but instead use the above
  59. # result variables.  Note that some hint names start in upper-case
  60. # "BOOST".  One may specify these as environment variables if they are
  61. # not specified as CMake variables or cache entries.
  62. #
  63. # This module first searches for the Boost header files using the above
  64. # hint variables (excluding BOOST_LIBRARYDIR) and saves the result in
  65. # Boost_INCLUDE_DIR.  Then it searches for requested component libraries
  66. # using the above hints (excluding BOOST_INCLUDEDIR and
  67. # Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR,
  68. # and the library name configuration settings below.  It saves the
  69. # library directories in Boost_LIBRARY_DIR_DEBUG and
  70. # Boost_LIBRARY_DIR_RELEASE and individual library
  71. # locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE.
  72. # When one changes settings used by previous searches in the same build
  73. # tree (excluding environment variables) this module discards previous
  74. # search results affected by the changes and searches again.
  75. #
  76. # Boost libraries come in many variants encoded in their file name.
  77. # Users or projects may tell this module which variant to find by
  78. # setting variables::
  79. #
  80. #   Boost_USE_MULTITHREADED  - Set to OFF to use the non-multithreaded
  81. #                              libraries ('mt' tag).  Default is ON.
  82. #   Boost_USE_STATIC_LIBS    - Set to ON to force the use of the static
  83. #                              libraries.  Default is OFF.
  84. #   Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
  85. #                              libraries linked statically to the C++ runtime
  86. #                              ('s' tag).  Default is platform dependent.
  87. #   Boost_USE_DEBUG_RUNTIME  - Set to ON or OFF to specify whether to use
  88. #                              libraries linked to the MS debug C++ runtime
  89. #                              ('g' tag).  Default is ON.
  90. #   Boost_USE_DEBUG_PYTHON   - Set to ON to use libraries compiled with a
  91. #                              debug Python build ('y' tag). Default is OFF.
  92. #   Boost_USE_STLPORT        - Set to ON to use libraries compiled with
  93. #                              STLPort ('p' tag).  Default is OFF.
  94. #   Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  95. #                            - Set to ON to use libraries compiled with
  96. #                              STLPort deprecated "native iostreams"
  97. #                              ('n' tag).  Default is OFF.
  98. #   Boost_COMPILER           - Set to the compiler-specific library suffix
  99. #                              (e.g. "-gcc43").  Default is auto-computed
  100. #                              for the C++ compiler in use.
  101. #   Boost_THREADAPI          - Suffix for "thread" component library name,
  102. #                              such as "pthread" or "win32".  Names with
  103. #                              and without this suffix will both be tried.
  104. #   Boost_NAMESPACE          - Alternate namespace used to build boost with
  105. #                              e.g. if set to "myboost", will search for
  106. #                              myboost_thread instead of boost_thread.
  107. #
  108. # Other variables one may set to control this module are::
  109. #
  110. #   Boost_DEBUG              - Set to ON to enable debug output from FindBoost.
  111. #                              Please enable this before filing any bug report.
  112. #   Boost_DETAILED_FAILURE_MSG
  113. #                            - Set to ON to add detailed information to the
  114. #                              failure message even when the REQUIRED option
  115. #                              is not given to the find_package call.
  116. #   Boost_REALPATH           - Set to ON to resolve symlinks for discovered
  117. #                              libraries to assist with packaging.  For example,
  118. #                              the "system" component library may be resolved to
  119. #                              "/usr/lib/libboost_system.so.1.42.0" instead of
  120. #                              "/usr/lib/libboost_system.so".  This does not
  121. #                              affect linking and should not be enabled unless
  122. #                              the user needs this information.
  123. #   Boost_LIBRARY_DIR        - Default value for Boost_LIBRARY_DIR_RELEASE and
  124. #                              Boost_LIBRARY_DIR_DEBUG.
  125. #
  126. # On Visual Studio and Borland compilers Boost headers request automatic
  127. # linking to corresponding libraries.  This requires matching libraries
  128. # to be linked explicitly or available in the link library search path.
  129. # In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve
  130. # dynamic linking.  Boost automatic linking typically requests static
  131. # libraries with a few exceptions (such as Boost.Python).  Use::
  132. #
  133. #   add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
  134. #
  135. # to ask Boost to report information about automatic linking requests.
  136. #
  137. # Example to find Boost headers only::
  138. #
  139. #   find_package(Boost 1.36.0)
  140. #   if(Boost_FOUND)
  141. #     include_directories(${Boost_INCLUDE_DIRS})
  142. #     add_executable(foo foo.cc)
  143. #   endif()
  144. #
  145. # Example to find Boost headers and some *static* libraries::
  146. #
  147. #   set(Boost_USE_STATIC_LIBS        ON) # only find static libs
  148. #   set(Boost_USE_MULTITHREADED      ON)
  149. #   set(Boost_USE_STATIC_RUNTIME    OFF)
  150. #   find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...)
  151. #   if(Boost_FOUND)
  152. #     include_directories(${Boost_INCLUDE_DIRS})
  153. #     add_executable(foo foo.cc)
  154. #     target_link_libraries(foo ${Boost_LIBRARIES})
  155. #   endif()
  156. #
  157. # Boost CMake
  158. # ^^^^^^^^^^^
  159. #
  160. # If Boost was built using the boost-cmake project it provides a package
  161. # configuration file for use with find_package's Config mode.  This
  162. # module looks for the package configuration file called
  163. # BoostConfig.cmake or boost-config.cmake and stores the result in cache
  164. # entry "Boost_DIR".  If found, the package configuration file is loaded
  165. # and this module returns with no further action.  See documentation of
  166. # the Boost CMake package configuration for details on what it provides.
  167. #
  168. # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
  169.  
  170. #=============================================================================
  171. # Copyright 2006-2012 Kitware, Inc.
  172. # Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
  173. # Copyright 2007      Wengo
  174. # Copyright 2007      Mike Jackson
  175. # Copyright 2008      Andreas Pakulat <apaku@gmx.de>
  176. # Copyright 2008-2012 Philip Lowman <philip@yhbt.com>
  177. #
  178. # Distributed under the OSI-approved BSD License (the "License");
  179. # see accompanying file Copyright.txt for details.
  180. #
  181. # This software is distributed WITHOUT ANY WARRANTY; without even the
  182. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  183. # See the License for more information.
  184. #=============================================================================
  185. # (To distribute this file outside of CMake, substitute the full
  186. #  License text for the above reference.)
  187.  
  188.  
  189. #-------------------------------------------------------------------------------
  190. # Before we go searching, check whether boost-cmake is available, unless the
  191. # user specifically asked NOT to search for boost-cmake.
  192. #
  193. # If Boost_DIR is set, this behaves as any find_package call would. If not,
  194. # it looks at BOOST_ROOT and BOOSTROOT to find Boost.
  195. #
  196. if (NOT Boost_NO_BOOST_CMAKE)
  197.   # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives,
  198.   # since these are more conventional for Boost.
  199.   if ("$ENV{Boost_DIR}" STREQUAL "")
  200.     if (NOT "$ENV{BOOST_ROOT}" STREQUAL "")
  201.       set(ENV{Boost_DIR} $ENV{BOOST_ROOT})
  202.     elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "")
  203.       set(ENV{Boost_DIR} $ENV{BOOSTROOT})
  204.     endif()
  205.   endif()
  206.  
  207.   # Do the same find_package call but look specifically for the CMake version.
  208.   # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
  209.   # need to delegate them to this find_package call.
  210.   find_package(Boost QUIET NO_MODULE)
  211.   mark_as_advanced(Boost_DIR)
  212.  
  213.   # If we found boost-cmake, then we're done.  Print out what we found.
  214.   # Otherwise let the rest of the module try to find it.
  215.   if (Boost_FOUND)
  216.     message("Boost ${Boost_FIND_VERSION} found.")
  217.     if (Boost_FIND_COMPONENTS)
  218.       message("Found Boost components:")
  219.       message("   ${Boost_FIND_COMPONENTS}")
  220.     endif()
  221.     return()
  222.   endif()
  223. endif()
  224.  
  225.  
  226. #-------------------------------------------------------------------------------
  227. #  FindBoost functions & macros
  228. #
  229.  
  230. ############################################
  231. #
  232. # Check the existence of the libraries.
  233. #
  234. ############################################
  235. # This macro was taken directly from the FindQt4.cmake file that is included
  236. # with the CMake distribution. This is NOT my work. All work was done by the
  237. # original authors of the FindQt4.cmake file. Only minor modifications were
  238. # made to remove references to Qt and make this file more generally applicable
  239. # And ELSE/ENDIF pairs were removed for readability.
  240. #########################################################################
  241.  
  242. macro(_Boost_ADJUST_LIB_VARS basename)
  243.   if(Boost_INCLUDE_DIR )
  244.     if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
  245.       # if the generator supports configuration types then set
  246.       # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
  247.       if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
  248.         set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  249.       else()
  250.         # if there are no configuration types and CMAKE_BUILD_TYPE has no value
  251.         # then just use the release libraries
  252.         set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
  253.       endif()
  254.       # FIXME: This probably should be set for both cases
  255.       set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
  256.     endif()
  257.  
  258.     # if only the release version was found, set the debug variable also to the release version
  259.     if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
  260.       set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
  261.       set(Boost_${basename}_LIBRARY       ${Boost_${basename}_LIBRARY_RELEASE})
  262.       set(Boost_${basename}_LIBRARIES     ${Boost_${basename}_LIBRARY_RELEASE})
  263.     endif()
  264.  
  265.     # if only the debug version was found, set the release variable also to the debug version
  266.     if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
  267.       set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
  268.       set(Boost_${basename}_LIBRARY         ${Boost_${basename}_LIBRARY_DEBUG})
  269.       set(Boost_${basename}_LIBRARIES       ${Boost_${basename}_LIBRARY_DEBUG})
  270.     endif()
  271.  
  272.     # If the debug & release library ends up being the same, omit the keywords
  273.     if(${Boost_${basename}_LIBRARY_RELEASE} STREQUAL ${Boost_${basename}_LIBRARY_DEBUG})
  274.       set(Boost_${basename}_LIBRARY   ${Boost_${basename}_LIBRARY_RELEASE} )
  275.       set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} )
  276.     endif()
  277.  
  278.     if(Boost_${basename}_LIBRARY)
  279.       set(Boost_${basename}_FOUND ON)
  280.     endif()
  281.  
  282.   endif()
  283.   # Make variables changeable to the advanced user
  284.   mark_as_advanced(
  285.       Boost_${basename}_LIBRARY_RELEASE
  286.       Boost_${basename}_LIBRARY_DEBUG
  287.   )
  288. endmacro()
  289.  
  290. # Detect changes in used variables.
  291. # Compares the current variable value with the last one.
  292. # In short form:
  293. # v != v_LAST                      -> CHANGED = 1
  294. # v is defined, v_LAST not         -> CHANGED = 1
  295. # v is not defined, but v_LAST is  -> CHANGED = 1
  296. # otherwise                        -> CHANGED = 0
  297. # CHANGED is returned in variable named ${changed_var}
  298. macro(_Boost_CHANGE_DETECT changed_var)
  299.   set(${changed_var} 0)
  300.   foreach(v ${ARGN})
  301.     if(DEFINED _Boost_COMPONENTS_SEARCHED)
  302.       if(${v})
  303.         if(_${v}_LAST)
  304.           string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED)
  305.         else()
  306.           set(_${v}_CHANGED 1)
  307.         endif()
  308.       elseif(_${v}_LAST)
  309.         set(_${v}_CHANGED 1)
  310.       endif()
  311.       if(_${v}_CHANGED)
  312.         set(${changed_var} 1)
  313.       endif()
  314.     else()
  315.       set(_${v}_CHANGED 0)
  316.     endif()
  317.   endforeach()
  318. endmacro()
  319.  
  320. #
  321. # Find the given library (var).
  322. # Use 'build_type' to support different lib paths for RELEASE or DEBUG builds
  323. #
  324. macro(_Boost_FIND_LIBRARY var build_type)
  325.  
  326.   find_library(${var} ${ARGN})
  327.  
  328.   if(${var})
  329.     # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
  330.     if(NOT Boost_LIBRARY_DIR_${build_type})
  331.       get_filename_component(_dir "${${var}}" PATH)
  332.       set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE)
  333.     endif()
  334.   elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  335.     # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG].
  336.     find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN})
  337.   endif()
  338.  
  339.   # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there.
  340.   if(Boost_LIBRARY_DIR_${build_type})
  341.     set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  342.     if(Boost_DEBUG)
  343.       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  344.         " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}"
  345.         " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}")
  346.     endif()
  347.   endif()
  348. endmacro()
  349.  
  350. #-------------------------------------------------------------------------------
  351.  
  352. #
  353. # Runs compiler with "-dumpversion" and parses major/minor
  354. # version with a regex.
  355. #
  356. function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
  357.  
  358.   exec_program(${CMAKE_CXX_COMPILER}
  359.     ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
  360.     OUTPUT_VARIABLE _boost_COMPILER_VERSION
  361.   )
  362.   string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
  363.     _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
  364.  
  365.   set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
  366. endfunction()
  367.  
  368. #
  369. # Take a list of libraries with "thread" in it
  370. # and prepend duplicates with "thread_${Boost_THREADAPI}"
  371. # at the front of the list
  372. #
  373. function(_Boost_PREPEND_LIST_WITH_THREADAPI _output)
  374.   set(_orig_libnames ${ARGN})
  375.   string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}")
  376.   set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE)
  377. endfunction()
  378.  
  379. #
  380. # If a library is found, replace its cache entry with its REALPATH
  381. #
  382. function(_Boost_SWAP_WITH_REALPATH _library _docstring)
  383.   if(${_library})
  384.     get_filename_component(_boost_filepathreal ${${_library}} REALPATH)
  385.     unset(${_library} CACHE)
  386.     set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}")
  387.   endif()
  388. endfunction()
  389.  
  390. function(_Boost_CHECK_SPELLING _var)
  391.   if(${_var})
  392.     string(TOUPPER ${_var} _var_UC)
  393.     message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling.  The proper spelling is ${_var_UC}.")
  394.   endif()
  395. endfunction()
  396.  
  397. # Guesses Boost's compiler prefix used in built library names
  398. # Returns the guess by setting the variable pointed to by _ret
  399. function(_Boost_GUESS_COMPILER_PREFIX _ret)
  400.   if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
  401.       OR CMAKE_CXX_COMPILER MATCHES "icl"
  402.       OR CMAKE_CXX_COMPILER MATCHES "icpc")
  403.     if(WIN32)
  404.       set (_boost_COMPILER "-iw")
  405.     else()
  406.       set (_boost_COMPILER "-il")
  407.     endif()
  408.   elseif (GHSMULTI)
  409.     set(_boost_COMPILER "-ghs")
  410.   elseif (MSVC14)
  411.     set(_boost_COMPILER "-vc140")
  412.   elseif (MSVC12)
  413.     set(_boost_COMPILER "-vc120")
  414.   elseif (MSVC11)
  415.     set(_boost_COMPILER "-vc110")
  416.   elseif (MSVC10)
  417.     set(_boost_COMPILER "-vc100")
  418.   elseif (MSVC90)
  419.     set(_boost_COMPILER "-vc90")
  420.   elseif (MSVC80)
  421.     set(_boost_COMPILER "-vc80")
  422.   elseif (MSVC71)
  423.     set(_boost_COMPILER "-vc71")
  424.   elseif (MSVC70) # Good luck!
  425.     set(_boost_COMPILER "-vc7") # yes, this is correct
  426.   elseif (MSVC60) # Good luck!
  427.     set(_boost_COMPILER "-vc6") # yes, this is correct
  428.   elseif (BORLAND)
  429.     set(_boost_COMPILER "-bcb")
  430.   elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
  431.     set(_boost_COMPILER "-sw")
  432.   elseif (MINGW)
  433.     if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  434.         set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
  435.     else()
  436.       _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  437.       set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
  438.     endif()
  439.   elseif (UNIX)
  440.     if (CMAKE_COMPILER_IS_GNUCXX)
  441.       if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
  442.         set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
  443.       else()
  444.         _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
  445.         # Determine which version of GCC we have.
  446.         if(APPLE)
  447.           if(Boost_MINOR_VERSION)
  448.             if(${Boost_MINOR_VERSION} GREATER 35)
  449.               # In Boost 1.36.0 and newer, the mangled compiler name used
  450.               # on Mac OS X/Darwin is "xgcc".
  451.               set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
  452.             else()
  453.               # In Boost <= 1.35.0, there is no mangled compiler name for
  454.               # the Mac OS X/Darwin version of GCC.
  455.               set(_boost_COMPILER "")
  456.             endif()
  457.           else()
  458.             # We don't know the Boost version, so assume it's
  459.             # pre-1.36.0.
  460.             set(_boost_COMPILER "")
  461.           endif()
  462.         else()
  463.           set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
  464.         endif()
  465.       endif()
  466.     endif ()
  467.   else()
  468.     # TODO at least Boost_DEBUG here?
  469.     set(_boost_COMPILER "")
  470.   endif()
  471.   set(${_ret} ${_boost_COMPILER} PARENT_SCOPE)
  472. endfunction()
  473.  
  474. #
  475. # End functions/macros
  476. #
  477. #-------------------------------------------------------------------------------
  478.  
  479. #-------------------------------------------------------------------------------
  480. # main.
  481. #-------------------------------------------------------------------------------
  482.  
  483.  
  484. # If the user sets Boost_LIBRARY_DIR, use it as the default for both
  485. # configurations.
  486. if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR)
  487.   set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}")
  488. endif()
  489. if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR)
  490.   set(Boost_LIBRARY_DIR_DEBUG   "${Boost_LIBRARY_DIR}")
  491. endif()
  492.  
  493. if(NOT DEFINED Boost_USE_MULTITHREADED)
  494.     set(Boost_USE_MULTITHREADED TRUE)
  495. endif()
  496. if(NOT DEFINED Boost_USE_DEBUG_RUNTIME)
  497.   set(Boost_USE_DEBUG_RUNTIME TRUE)
  498. endif()
  499.  
  500. # Check the version of Boost against the requested version.
  501. if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
  502.   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")
  503. endif()
  504.  
  505. if(Boost_FIND_VERSION_EXACT)
  506.   # The version may appear in a directory with or without the patch
  507.   # level, even when the patch level is non-zero.
  508.   set(_boost_TEST_VERSIONS
  509.     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
  510.     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  511. else()
  512.   # The user has not requested an exact version.  Among known
  513.   # versions, find those that are acceptable to the user request.
  514.   set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
  515.     "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54"
  516.     "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"
  517.     "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1"
  518.     "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"
  519.     "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"
  520.     "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
  521.     "1.34" "1.33.1" "1.33.0" "1.33")
  522.   set(_boost_TEST_VERSIONS)
  523.   if(Boost_FIND_VERSION)
  524.     set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  525.     # Select acceptable versions.
  526.     foreach(version ${_Boost_KNOWN_VERSIONS})
  527.       if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
  528.         # This version is high enough.
  529.         list(APPEND _boost_TEST_VERSIONS "${version}")
  530.       elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
  531.         # This version is a short-form for the requested version with
  532.         # the patch level dropped.
  533.         list(APPEND _boost_TEST_VERSIONS "${version}")
  534.       endif()
  535.     endforeach()
  536.   else()
  537.     # Any version is acceptable.
  538.     set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
  539.   endif()
  540. endif()
  541.  
  542. # The reason that we failed to find Boost. This will be set to a
  543. # user-friendly message when we fail to find some necessary piece of
  544. # Boost.
  545. set(Boost_ERROR_REASON)
  546.  
  547. if(Boost_DEBUG)
  548.   # Output some of their choices
  549.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  550.                  "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  551.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  552.                  "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
  553.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  554.                  "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
  555.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  556.                  "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
  557.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  558.                  "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
  559.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  560.                  "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
  561. endif()
  562.  
  563. if(WIN32)
  564.   # In windows, automatic linking is performed, so you do not have
  565.   # to specify the libraries.  If you are linking to a dynamic
  566.   # runtime, then you can choose to link to either a static or a
  567.   # dynamic Boost library, the default is to do a static link.  You
  568.   # can alter this for a specific library "whatever" by defining
  569.   # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
  570.   # linked dynamically.  Alternatively you can force all Boost
  571.   # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
  572.  
  573.   # This feature can be disabled for Boost library "whatever" by
  574.   # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
  575.   # BOOST_ALL_NO_LIB.
  576.  
  577.   # If you want to observe which libraries are being linked against
  578.   # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
  579.   # code to emit a #pragma message each time a library is selected
  580.   # for linking.
  581.   set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
  582. endif()
  583.  
  584. _Boost_CHECK_SPELLING(Boost_ROOT)
  585. _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
  586. _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
  587.  
  588. # Collect environment variable inputs as hints.  Do not consider changes.
  589. foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
  590.   set(_env $ENV{${v}})
  591.   if(_env)
  592.     file(TO_CMAKE_PATH "${_env}" _ENV_${v})
  593.   else()
  594.     set(_ENV_${v} "")
  595.   endif()
  596. endforeach()
  597. if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
  598.   set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
  599. endif()
  600.  
  601. # Collect inputs and cached results.  Detect changes since the last run.
  602. if(NOT BOOST_ROOT AND BOOSTROOT)
  603.   set(BOOST_ROOT "${BOOSTROOT}")
  604. endif()
  605. set(_Boost_VARS_DIR
  606.   BOOST_ROOT
  607.   Boost_NO_SYSTEM_PATHS
  608.   )
  609.  
  610. if(Boost_DEBUG)
  611.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  612.                  "Declared as CMake or Environmental Variables:")
  613.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  614.                  "  BOOST_ROOT = ${BOOST_ROOT}")
  615.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  616.                  "  BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
  617.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  618.                  "  BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
  619.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  620.                  "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
  621. endif()
  622.  
  623. # ------------------------------------------------------------------------
  624. #  Search for Boost include DIR
  625. # ------------------------------------------------------------------------
  626.  
  627. set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
  628. _Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
  629. # Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
  630. # location did.  We will find a new one based on the new inputs.
  631. if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
  632.   unset(Boost_INCLUDE_DIR CACHE)
  633. endif()
  634.  
  635. if(NOT Boost_INCLUDE_DIR)
  636.   set(_boost_INCLUDE_SEARCH_DIRS "")
  637.   if(BOOST_INCLUDEDIR)
  638.     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
  639.   elseif(_ENV_BOOST_INCLUDEDIR)
  640.     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
  641.   endif()
  642.  
  643.   if( BOOST_ROOT )
  644.     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
  645.   elseif( _ENV_BOOST_ROOT )
  646.     list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
  647.   endif()
  648.  
  649.   if( Boost_NO_SYSTEM_PATHS)
  650.     list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
  651.   else()
  652.     list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
  653.       C:/boost/include
  654.       C:/boost
  655.       /sw/local/include
  656.       )
  657.   endif()
  658.  
  659.   # Try to find Boost by stepping backwards through the Boost versions
  660.   # we know about.
  661.   # Build a list of path suffixes for each version.
  662.   set(_boost_PATH_SUFFIXES)
  663.   foreach(_boost_VER ${_boost_TEST_VERSIONS})
  664.     # Add in a path suffix, based on the required version, ideally
  665.     # we could read this from version.hpp, but for that to work we'd
  666.     # need to know the include dir already
  667.     set(_boost_BOOSTIFIED_VERSION)
  668.  
  669.     # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
  670.     if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
  671.         set(_boost_BOOSTIFIED_VERSION
  672.           "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}")
  673.     elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)")
  674.         set(_boost_BOOSTIFIED_VERSION
  675.           "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
  676.     endif()
  677.  
  678.     list(APPEND _boost_PATH_SUFFIXES
  679.       "boost-${_boost_BOOSTIFIED_VERSION}"
  680.       "boost_${_boost_BOOSTIFIED_VERSION}"
  681.       "boost/boost-${_boost_BOOSTIFIED_VERSION}"
  682.       "boost/boost_${_boost_BOOSTIFIED_VERSION}"
  683.       )
  684.  
  685.   endforeach()
  686.  
  687.   if(Boost_DEBUG)
  688.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  689.                    "Include debugging info:")
  690.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  691.                    "  _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
  692.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  693.                    "  _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
  694.   endif()
  695.  
  696.   # Look for a standard boost header file.
  697.   find_path(Boost_INCLUDE_DIR
  698.     NAMES         boost/config.hpp
  699.     HINTS         ${_boost_INCLUDE_SEARCH_DIRS}
  700.     PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
  701.     )
  702. endif()
  703.  
  704. # ------------------------------------------------------------------------
  705. #  Extract version information from version.hpp
  706. # ------------------------------------------------------------------------
  707.  
  708. # Set Boost_FOUND based only on header location and version.
  709. # It will be updated below for component libraries.
  710. if(Boost_INCLUDE_DIR)
  711.   if(Boost_DEBUG)
  712.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  713.                    "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
  714.   endif()
  715.  
  716.   # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
  717.   set(Boost_VERSION 0)
  718.   set(Boost_LIB_VERSION "")
  719.   file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
  720.   set(_Boost_VERSION_REGEX "([0-9]+)")
  721.   set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
  722.   foreach(v VERSION LIB_VERSION)
  723.     if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}")
  724.       set(Boost_${v} "${CMAKE_MATCH_1}")
  725.     endif()
  726.   endforeach()
  727.   unset(_boost_VERSION_HPP_CONTENTS)
  728.  
  729.   math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
  730.   math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
  731.   math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
  732.  
  733.   set(Boost_ERROR_REASON
  734.     "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
  735.   if(Boost_DEBUG)
  736.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  737.                    "version.hpp reveals boost "
  738.                    "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  739.   endif()
  740.  
  741.   if(Boost_FIND_VERSION)
  742.     # Set Boost_FOUND based on requested version.
  743.     set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  744.     if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
  745.       set(Boost_FOUND 0)
  746.       set(_Boost_VERSION_AGE "old")
  747.     elseif(Boost_FIND_VERSION_EXACT AND
  748.         NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
  749.       set(Boost_FOUND 0)
  750.       set(_Boost_VERSION_AGE "new")
  751.     else()
  752.       set(Boost_FOUND 1)
  753.     endif()
  754.     if(NOT Boost_FOUND)
  755.       # State that we found a version of Boost that is too new or too old.
  756.       set(Boost_ERROR_REASON
  757.         "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
  758.       if (Boost_FIND_VERSION_PATCH)
  759.         set(Boost_ERROR_REASON
  760.           "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
  761.       endif ()
  762.       if (NOT Boost_FIND_VERSION_EXACT)
  763.         set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
  764.       endif ()
  765.       set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
  766.     endif ()
  767.   else()
  768.     # Caller will accept any Boost version.
  769.     set(Boost_FOUND 1)
  770.   endif()
  771. else()
  772.   set(Boost_FOUND 0)
  773.   set(Boost_ERROR_REASON
  774.     "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
  775. endif()
  776.  
  777. # ------------------------------------------------------------------------
  778. #  Prefix initialization
  779. # ------------------------------------------------------------------------
  780.  
  781. set(Boost_LIB_PREFIX "")
  782. if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR
  783.     (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) )
  784.   set(Boost_LIB_PREFIX "lib")
  785. endif()
  786.  
  787. if ( NOT Boost_NAMESPACE )
  788.   set(Boost_NAMESPACE "boost")
  789. endif()
  790.  
  791. # ------------------------------------------------------------------------
  792. #  Suffix initialization and compiler suffix detection.
  793. # ------------------------------------------------------------------------
  794.  
  795. set(_Boost_VARS_NAME
  796.   Boost_NAMESPACE
  797.   Boost_COMPILER
  798.   Boost_THREADAPI
  799.   Boost_USE_DEBUG_PYTHON
  800.   Boost_USE_MULTITHREADED
  801.   Boost_USE_STATIC_LIBS
  802.   Boost_USE_STATIC_RUNTIME
  803.   Boost_USE_STLPORT
  804.   Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
  805.   )
  806. _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
  807.  
  808. # Setting some more suffixes for the library
  809. if (Boost_COMPILER)
  810.   set(_boost_COMPILER ${Boost_COMPILER})
  811.   if(Boost_DEBUG)
  812.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  813.                    "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
  814.   endif()
  815. else()
  816.   # Attempt to guess the compiler suffix
  817.   # NOTE: this is not perfect yet, if you experience any issues
  818.   # please report them and use the Boost_COMPILER variable
  819.   # to work around the problems.
  820.   _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
  821.   if(Boost_DEBUG)
  822.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  823.       "guessed _boost_COMPILER = ${_boost_COMPILER}")
  824.   endif()
  825. endif()
  826.  
  827. set (_boost_MULTITHREADED "-mt")
  828. if( NOT Boost_USE_MULTITHREADED )
  829.   set (_boost_MULTITHREADED "")
  830. endif()
  831. if(Boost_DEBUG)
  832.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  833.     "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  834. endif()
  835.  
  836. #======================
  837. # Systematically build up the Boost ABI tag
  838. # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
  839. set( _boost_RELEASE_ABI_TAG "-")
  840. set( _boost_DEBUG_ABI_TAG   "-")
  841. # Key       Use this library when:
  842. #  s        linking statically to the C++ standard library and
  843. #           compiler runtime support libraries.
  844. if(Boost_USE_STATIC_RUNTIME)
  845.   set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
  846.   set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}s")
  847. endif()
  848. #  g        using debug versions of the standard and runtime
  849. #           support libraries
  850. if(WIN32 AND Boost_USE_DEBUG_RUNTIME)
  851.   if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
  852.           OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
  853.     set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
  854.   endif()
  855. endif()
  856. #  y        using special debug build of python
  857. if(Boost_USE_DEBUG_PYTHON)
  858.   set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
  859. endif()
  860. #  d        using a debug version of your code
  861. set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
  862. #  p        using the STLport standard library rather than the
  863. #           default one supplied with your compiler
  864. if(Boost_USE_STLPORT)
  865.   set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
  866.   set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}p")
  867. endif()
  868. #  n        using the STLport deprecated "native iostreams" feature
  869. if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
  870.   set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
  871.   set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}n")
  872. endif()
  873.  
  874. if(Boost_DEBUG)
  875.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  876.     "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
  877.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  878.     "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
  879. endif()
  880.  
  881. # ------------------------------------------------------------------------
  882. #  Begin finding boost libraries
  883. # ------------------------------------------------------------------------
  884.  
  885. set(_Boost_VARS_LIB "")
  886. foreach(c DEBUG RELEASE)
  887.   set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c})
  888.   list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}})
  889.   _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR)
  890.   # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the
  891.   # location did.  We will find a new one based on the new inputs.
  892.   if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED)
  893.     unset(Boost_LIBRARY_DIR_${c} CACHE)
  894.   endif()
  895.  
  896.   # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value.
  897.   if(Boost_LIBRARY_DIR_${c})
  898.     set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  899.   else()
  900.     set(_boost_LIBRARY_SEARCH_DIRS_${c} "")
  901.     if(BOOST_LIBRARYDIR)
  902.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR})
  903.     elseif(_ENV_BOOST_LIBRARYDIR)
  904.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR})
  905.     endif()
  906.  
  907.     if(BOOST_ROOT)
  908.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
  909.     elseif(_ENV_BOOST_ROOT)
  910.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
  911.     endif()
  912.  
  913.     list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c}
  914.       ${Boost_INCLUDE_DIR}/lib
  915.       ${Boost_INCLUDE_DIR}/../lib
  916.       ${Boost_INCLUDE_DIR}/stage/lib
  917.       )
  918.     if( Boost_NO_SYSTEM_PATHS )
  919.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH)
  920.     else()
  921.       list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS
  922.         C:/boost/lib
  923.         C:/boost
  924.         /sw/local/lib
  925.         )
  926.     endif()
  927.   endif()
  928. endforeach()
  929.  
  930. if(Boost_DEBUG)
  931.   message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  932.     "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}"
  933.     "_boost_LIBRARY_SEARCH_DIRS_DEBUG   = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  934. endif()
  935.  
  936. # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
  937. if( Boost_USE_STATIC_LIBS )
  938.   set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  939.   if(WIN32)
  940.     set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  941.   else()
  942.     set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
  943.   endif()
  944. endif()
  945.  
  946. # We want to use the tag inline below without risking double dashes
  947. if(_boost_RELEASE_ABI_TAG)
  948.   if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
  949.     set(_boost_RELEASE_ABI_TAG "")
  950.   endif()
  951. endif()
  952. if(_boost_DEBUG_ABI_TAG)
  953.   if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
  954.     set(_boost_DEBUG_ABI_TAG "")
  955.   endif()
  956. endif()
  957.  
  958. # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
  959. # on WIN32 was to:
  960. #  1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
  961. #  2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
  962. # We maintain this behavior since changing it could break people's builds.
  963. # To disable the ambiguous behavior, the user need only
  964. # set Boost_USE_STATIC_RUNTIME either ON or OFF.
  965. set(_boost_STATIC_RUNTIME_WORKAROUND false)
  966. if(WIN32 AND Boost_USE_STATIC_LIBS)
  967.   if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
  968.     set(_boost_STATIC_RUNTIME_WORKAROUND true)
  969.   endif()
  970. endif()
  971.  
  972. # On versions < 1.35, remove the System library from the considered list
  973. # since it wasn't added until 1.35.
  974. if(Boost_VERSION AND Boost_FIND_COMPONENTS)
  975.    if(Boost_VERSION LESS 103500)
  976.      list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
  977.    endif()
  978. endif()
  979.  
  980. # If the user changed any of our control inputs flush previous results.
  981. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
  982.   foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
  983.     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  984.     foreach(c DEBUG RELEASE)
  985.       set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
  986.       unset(${_var} CACHE)
  987.       set(${_var} "${_var}-NOTFOUND")
  988.     endforeach()
  989.   endforeach()
  990.   set(_Boost_COMPONENTS_SEARCHED "")
  991. endif()
  992.  
  993. foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  994.   string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  995.  
  996.   set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
  997.   set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
  998.  
  999.   # Compute component-specific hints.
  1000.   set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
  1001.   if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
  1002.      ${COMPONENT} STREQUAL "graph_parallel")
  1003.     foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
  1004.       if(IS_ABSOLUTE "${lib}")
  1005.         get_filename_component(libdir "${lib}" PATH)
  1006.         string(REPLACE "\\" "/" libdir "${libdir}")
  1007.         list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir})
  1008.       endif()
  1009.     endforeach()
  1010.   endif()
  1011.  
  1012.   # Consolidate and report component-specific hints.
  1013.   if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1014.     list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT)
  1015.     if(Boost_DEBUG)
  1016.       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1017.         "Component-specific library search paths for ${COMPONENT}: "
  1018.         "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}")
  1019.     endif()
  1020.   endif()
  1021.  
  1022.   #
  1023.   # Find RELEASE libraries
  1024.   #
  1025.   set(_boost_RELEASE_NAMES
  1026.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  1027.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1028.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
  1029.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
  1030.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  1031.   if(_boost_STATIC_RUNTIME_WORKAROUND)
  1032.     set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
  1033.     list(APPEND _boost_RELEASE_NAMES
  1034.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1035.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
  1036.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1037.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
  1038.   endif()
  1039.   if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1040.      _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
  1041.   endif()
  1042.   if(Boost_DEBUG)
  1043.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1044.                    "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
  1045.   endif()
  1046.  
  1047.   # if Boost_LIBRARY_DIR_RELEASE is not defined,
  1048.   # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs
  1049.   if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG)
  1050.     list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG})
  1051.   endif()
  1052.  
  1053.   # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1054.   string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}")
  1055.  
  1056.   _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE
  1057.     NAMES ${_boost_RELEASE_NAMES}
  1058.     HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1059.     NAMES_PER_DIR
  1060.     DOC "${_boost_docstring_release}"
  1061.     )
  1062.  
  1063.   #
  1064.   # Find DEBUG libraries
  1065.   #
  1066.   set(_boost_DEBUG_NAMES
  1067.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  1068.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1069.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
  1070.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
  1071.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
  1072.     ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
  1073.   if(_boost_STATIC_RUNTIME_WORKAROUND)
  1074.     set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
  1075.     list(APPEND _boost_DEBUG_NAMES
  1076.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1077.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
  1078.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
  1079.       ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
  1080.   endif()
  1081.   if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
  1082.      _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
  1083.   endif()
  1084.   if(Boost_DEBUG)
  1085.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
  1086.                    "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
  1087.   endif()
  1088.  
  1089.   # if Boost_LIBRARY_DIR_DEBUG is not defined,
  1090.   # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs
  1091.   if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE)
  1092.     list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE})
  1093.   endif()
  1094.  
  1095.   # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
  1096.   string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}")
  1097.  
  1098.   _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG
  1099.     NAMES ${_boost_DEBUG_NAMES}
  1100.     HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp}
  1101.     NAMES_PER_DIR
  1102.     DOC "${_boost_docstring_debug}"
  1103.     )
  1104.  
  1105.   if(Boost_REALPATH)
  1106.     _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
  1107.     _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG   "${_boost_docstring_debug}"  )
  1108.   endif()
  1109.  
  1110.   _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
  1111.  
  1112. endforeach()
  1113.  
  1114. # Restore the original find library ordering
  1115. if( Boost_USE_STATIC_LIBS )
  1116.   set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  1117. endif()
  1118.  
  1119. # ------------------------------------------------------------------------
  1120. #  End finding boost libraries
  1121. # ------------------------------------------------------------------------
  1122.  
  1123. set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
  1124. set(Boost_LIBRARY_DIRS)
  1125. if(Boost_LIBRARY_DIR_RELEASE)
  1126.   list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE})
  1127. endif()
  1128. if(Boost_LIBRARY_DIR_DEBUG)
  1129.   list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG})
  1130. endif()
  1131. if(Boost_LIBRARY_DIRS)
  1132.   list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
  1133. endif()
  1134.  
  1135. # The above setting of Boost_FOUND was based only on the header files.
  1136. # Update it for the requested component libraries.
  1137. if(Boost_FOUND)
  1138.   # The headers were found.  Check for requested component libs.
  1139.   set(_boost_CHECKED_COMPONENT FALSE)
  1140.   set(_Boost_MISSING_COMPONENTS "")
  1141.   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1142.     string(TOUPPER ${COMPONENT} COMPONENT)
  1143.     set(_boost_CHECKED_COMPONENT TRUE)
  1144.     if(NOT Boost_${COMPONENT}_FOUND)
  1145.       string(TOLOWER ${COMPONENT} COMPONENT)
  1146.       list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
  1147.     endif()
  1148.   endforeach()
  1149.  
  1150.   if(Boost_DEBUG)
  1151.     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
  1152.   endif()
  1153.  
  1154.   if (_Boost_MISSING_COMPONENTS)
  1155.     set(Boost_FOUND 0)
  1156.     # We were unable to find some libraries, so generate a sensible
  1157.     # error message that lists the libraries we were unable to find.
  1158.     set(Boost_ERROR_REASON
  1159.       "${Boost_ERROR_REASON}\nCould not find the following")
  1160.     if(Boost_USE_STATIC_LIBS)
  1161.       set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static")
  1162.     endif()
  1163.     set(Boost_ERROR_REASON
  1164.       "${Boost_ERROR_REASON} Boost libraries:\n")
  1165.     foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
  1166.       set(Boost_ERROR_REASON
  1167.         "${Boost_ERROR_REASON}        ${Boost_NAMESPACE}_${COMPONENT}\n")
  1168.     endforeach()
  1169.  
  1170.     list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
  1171.     list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
  1172.     if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
  1173.       set(Boost_ERROR_REASON
  1174.         "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
  1175.     else ()
  1176.       set(Boost_ERROR_REASON
  1177.         "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
  1178.     endif ()
  1179.   endif ()
  1180.  
  1181.   if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
  1182.     # Compatibility Code for backwards compatibility with CMake
  1183.     # 2.4's FindBoost module.
  1184.  
  1185.     # Look for the boost library path.
  1186.     # Note that the user may not have installed any libraries
  1187.     # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
  1188.     set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
  1189.  
  1190.     if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
  1191.       get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1192.     endif()
  1193.  
  1194.     if("${_boost_LIB_DIR}" MATCHES "/include$")
  1195.       # Strip off the trailing "/include" in the path.
  1196.       get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
  1197.     endif()
  1198.  
  1199.     if(EXISTS "${_boost_LIB_DIR}/lib")
  1200.       set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
  1201.     else()
  1202.       if(EXISTS "${_boost_LIB_DIR}/stage/lib")
  1203.         set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
  1204.       else()
  1205.         set(_boost_LIB_DIR "")
  1206.       endif()
  1207.     endif()
  1208.  
  1209.     if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
  1210.       set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
  1211.     endif()
  1212.  
  1213.   endif()
  1214. else()
  1215.   # Boost headers were not found so no components were found.
  1216.   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
  1217.     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
  1218.     set(Boost_${UPPERCOMPONENT}_FOUND 0)
  1219.   endforeach()
  1220. endif()
  1221.  
  1222. # ------------------------------------------------------------------------
  1223. #  Notification to end user about what was found
  1224. # ------------------------------------------------------------------------
  1225.  
  1226. set(Boost_LIBRARIES "")
  1227. if(Boost_FOUND)
  1228.   if(NOT Boost_FIND_QUIETLY)
  1229.     message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
  1230.     if(Boost_FIND_COMPONENTS)
  1231.       message(STATUS "Found the following Boost libraries:")
  1232.     endif()
  1233.   endif()
  1234.   foreach( COMPONENT  ${Boost_FIND_COMPONENTS} )
  1235.     string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
  1236.     if( Boost_${UPPERCOMPONENT}_FOUND )
  1237.       if(NOT Boost_FIND_QUIETLY)
  1238.         message (STATUS "  ${COMPONENT}")
  1239.       endif()
  1240.       list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
  1241.     endif()
  1242.   endforeach()
  1243. else()
  1244.   if(Boost_FIND_REQUIRED)
  1245.     message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
  1246.   else()
  1247.     if(NOT Boost_FIND_QUIETLY)
  1248.       # we opt not to automatically output Boost_ERROR_REASON here as
  1249.       # it could be quite lengthy and somewhat imposing in its requests
  1250.       # Since Boost is not always a required dependency we'll leave this
  1251.       # up to the end-user.
  1252.       if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
  1253.         message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
  1254.       else()
  1255.         message(STATUS "Could NOT find Boost")
  1256.       endif()
  1257.     endif()
  1258.   endif()
  1259. endif()
  1260.  
  1261. # Configure display of cache entries in GUI.
  1262. foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
  1263.   get_property(_type CACHE ${v} PROPERTY TYPE)
  1264.   if(_type)
  1265.     set_property(CACHE ${v} PROPERTY ADVANCED 1)
  1266.     if("x${_type}" STREQUAL "xUNINITIALIZED")
  1267.       if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
  1268.         set_property(CACHE ${v} PROPERTY TYPE STRING)
  1269.       else()
  1270.         set_property(CACHE ${v} PROPERTY TYPE PATH)
  1271.       endif()
  1272.     endif()
  1273.   endif()
  1274. endforeach()
  1275.  
  1276. # Record last used values of input variables so we can
  1277. # detect on the next run if the user changed them.
  1278. foreach(v
  1279.     ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
  1280.     ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
  1281.     )
  1282.   if(DEFINED ${v})
  1283.     set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
  1284.   else()
  1285.     unset(_${v}_LAST CACHE)
  1286.   endif()
  1287. endforeach()
  1288.  
  1289. # Maintain a persistent list of components requested anywhere since
  1290. # the last flush.
  1291. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
  1292. list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
  1293. list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
  1294. list(SORT _Boost_COMPONENTS_SEARCHED)
  1295. set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
  1296.   CACHE INTERNAL "Components requested for this build tree.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement