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