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