Be less explicit about namespace
[hiphop-php.git] / CMake / FindBoost.cmake
blob47442a24047f8ff4fed8ba170b76bcece6aeaae7
1 # - Try to find Boost include dirs and libraries
2 # Usage of this module as follows:
4 # NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below.
5 # Due to Boost naming conventions and limitations in CMake this find
6 # module is NOT future safe with respect to Boost version numbers,
7 # and may break.
9 # == Using Header-Only libraries from within Boost: ==
11 #   find_package( Boost 1.36.0 )
12 #   if(Boost_FOUND)
13 #      include_directories(${Boost_INCLUDE_DIRS})
14 #      add_executable(foo foo.cc)
15 #   endif()
18 # == Using actual libraries from within Boost: ==
20 #   set(Boost_USE_STATIC_LIBS   ON)
21 #   set(Boost_USE_MULTITHREADED ON)
22 #   find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
24 #   if(Boost_FOUND)
25 #      include_directories(${Boost_INCLUDE_DIRS})
26 #      add_executable(foo foo.cc)
27 #      target_link_libraries(foo ${Boost_LIBRARIES})
28 #   endif()
31 # The components list needs to contain actual names of boost libraries only,
32 # such as "date_time" for "libboost_date_time".  If you're using parts of
33 # Boost that contain header files only (e.g. foreach) you do not need to
34 # specify COMPONENTS.
36 # You should provide a minimum version number that should be used. If you provide this 
37 # version number and specify the REQUIRED attribute, this module will fail if it
38 # can't find the specified or a later version. If you specify a version number this is
39 # automatically put into the considered list of version numbers and thus doesn't need
40 # to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
42 # NOTE for Visual Studio Users:
43 #     Automatic linking is used on MSVC & Borland compilers by default when
44 #     #including things in Boost.  It's important to note that setting
45 #     Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
46 #     should you need this feature.  Automatic linking typically uses static
47 #     libraries with a few exceptions (Boost.Python is one).
49 #     Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
50 #     more details.  Adding a TARGET_LINK_LIBRARIES() as shown in the example
51 #     above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
52 #     gets set to OFF.  It is suggested you avoid automatic linking since it
53 #     will make your application less portable.
55 # =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
57 # OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
58 # boost version numbers that should be taken into account when searching
59 # for Boost. Unfortunately boost puts the version number into the
60 # actual filename for the libraries, so this variable will certainly be needed
61 # in the future when new Boost versions are released.
63 # Currently this module searches for the following version numbers:
64 # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
65 # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
66 # 1.40, 1.40.0, 1.41, 1.41.0
68 # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
69 # add both 1.x and 1.x.0 as shown above.  Official Boost include directories
70 # omit the 3rd version number from include paths if it is 0 although not all
71 # binary Boost releases do so.
73 # SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
75 # ===================================== ============= ========================
77 # Variables used by this module, they can change the default behaviour and
78 # need to be set before calling find_package:
80 #   Boost_USE_MULTITHREADED      Can be set to OFF to use the non-multithreaded
81 #                                boost libraries.  If not specified, defaults
82 #                                to ON.
84 #   Boost_USE_STATIC_LIBS        Can be set to ON to force the use of the static
85 #                                boost libraries. Defaults to OFF.
87 # Other Variables used by this module which you may want to set.
89 #   Boost_ADDITIONAL_VERSIONS    A list of version numbers to use for searching
90 #                                the boost include directory.  Please see
91 #                                the documentation above regarding this
92 #                                annoying, but necessary variable :(
94 #   Boost_DEBUG                  Set this to TRUE to enable debugging output
95 #                                of FindBoost.cmake if you are having problems.
96 #                                Please enable this before filing any bug
97 #                                reports.
99 #   Boost_DETAILED_FAILURE_MSG   FindBoost doesn't output detailed information
100 #                                about why it failed or how to fix the problem
101 #                                unless this is set to TRUE or the REQUIRED
102 #                                keyword is specified in find_package().
103 #                                  [Since CMake 2.8.0]
105 #   Boost_COMPILER               Set this to the compiler suffix used by Boost
106 #                                (e.g. "-gcc43") if FindBoost has problems finding
107 #                                the proper Boost installation
109 # These last three variables are available also as environment variables:
111 #   BOOST_ROOT or BOOSTROOT      The preferred installation prefix for searching for
112 #                                Boost.  Set this if the module has problems finding
113 #                                the proper Boost installation.
115 #   BOOST_INCLUDEDIR             Set this to the include directory of Boost, if the
116 #                                module has problems finding the proper Boost installation
118 #   BOOST_LIBRARYDIR             Set this to the lib directory of Boost, if the
119 #                                module has problems finding the proper Boost installation
121 # Variables defined by this module:
123 #   Boost_FOUND                         System has Boost, this means the include dir was
124 #                                       found, as well as all the libraries specified in
125 #                                       the COMPONENTS list.
127 #   Boost_INCLUDE_DIRS                  Boost include directories: not cached
129 #   Boost_INCLUDE_DIR                   This is almost the same as above, but this one is
130 #                                       cached and may be modified by advanced users
132 #   Boost_LIBRARIES                     Link to these to use the Boost libraries that you
133 #                                       specified: not cached
135 #   Boost_LIBRARY_DIRS                  The path to where the Boost library files are.
137 #   Boost_VERSION                       The version number of the boost libraries that
138 #                                       have been found, same as in version.hpp from Boost
140 #   Boost_LIB_VERSION                   The version number in filename form as
141 #                                       it's appended to the library filenames
143 #   Boost_MAJOR_VERSION                 major version number of boost
144 #   Boost_MINOR_VERSION                 minor version number of boost
145 #   Boost_SUBMINOR_VERSION              subminor version number of boost
147 #   Boost_LIB_DIAGNOSTIC_DEFINITIONS    [WIN32 Only] You can call
148 #                                       add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
149 #                                       to have diagnostic information about Boost's
150 #                                       automatic linking outputted during compilation time.
152 # For each component you specify in find_package(), the following (UPPER-CASE)
153 # variables are set.  You can use these variables if you would like to pick and
154 # choose components for your targets instead of just using Boost_LIBRARIES.
156 #   Boost_${COMPONENT}_FOUND            True IF the Boost library "component" was found.
158 #   Boost_${COMPONENT}_LIBRARY          Contains the libraries for the specified Boost
159 #                                       "component" (includes debug and optimized keywords
160 #                                       when needed).
162 #=============================================================================
163 # Copyright 2006-2009 Kitware, Inc.
164 # Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
165 # Copyright 2007      Wengo
166 # Copyright 2007      Mike Jackson
167 # Copyright 2008      Andreas Pakulat <apaku@gmx.de>
168 # Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
170 # Distributed under the OSI-approved BSD License (the "License");
171 # see accompanying file Copyright.txt for details.
173 # This software is distributed WITHOUT ANY WARRANTY; without even the
174 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
175 # See the License for more information.
176 #=============================================================================
177 # (To distributed this file outside of CMake, substitute the full
178 #  License text for the above reference.)
180 #-------------------------------------------------------------------------------
181 #  FindBoost functions & macros
183 ############################################
185 # Check the existence of the libraries.
187 ############################################
188 # This macro was taken directly from the FindQt4.cmake file that is included
189 # with the CMake distribution. This is NOT my work. All work was done by the
190 # original authors of the FindQt4.cmake file. Only minor modifications were
191 # made to remove references to Qt and make this file more generally applicable
192 # And ELSE/ENDIF pairs were removed for readability.
193 #########################################################################
195 MACRO (_Boost_ADJUST_LIB_VARS basename)
196   IF (Boost_INCLUDE_DIR )
197     IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
198       # if the generator supports configuration types then set
199       # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
200       IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
201         SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
202       ELSE()
203         # if there are no configuration types and CMAKE_BUILD_TYPE has no value
204         # then just use the release libraries
205         SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
206       ENDIF()
207       # FIXME: This probably should be set for both cases
208       SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
209     ENDIF()
211     # if only the release version was found, set the debug variable also to the release version
212     IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
213       SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
214       SET(Boost_${basename}_LIBRARY       ${Boost_${basename}_LIBRARY_RELEASE})
215       SET(Boost_${basename}_LIBRARIES     ${Boost_${basename}_LIBRARY_RELEASE})
216     ENDIF()
218     # if only the debug version was found, set the release variable also to the debug version
219     IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
220       SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
221       SET(Boost_${basename}_LIBRARY         ${Boost_${basename}_LIBRARY_DEBUG})
222       SET(Boost_${basename}_LIBRARIES       ${Boost_${basename}_LIBRARY_DEBUG})
223     ENDIF()
224     
225     IF (Boost_${basename}_LIBRARY)
226       set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
228       # Remove superfluous "debug" / "optimized" keywords from
229       # Boost_LIBRARY_DIRS
230       FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY})
231         GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH)
232         LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
233       ENDFOREACH()
234       LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
236       set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
237       SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
238     ENDIF(Boost_${basename}_LIBRARY)
240   ENDIF (Boost_INCLUDE_DIR )
241   # Make variables changeble to the advanced user
242   MARK_AS_ADVANCED(
243       Boost_${basename}_LIBRARY
244       Boost_${basename}_LIBRARY_RELEASE
245       Boost_${basename}_LIBRARY_DEBUG
246   )
247 ENDMACRO (_Boost_ADJUST_LIB_VARS)
249 #-------------------------------------------------------------------------------
252 # Runs compiler with "-dumpversion" and parses major/minor
253 # version with a regex.
255 FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
257   EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
258     ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
259     OUTPUT_VARIABLE _boost_COMPILER_VERSION
260   )
261   STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
262     _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
264   SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
265 ENDFUNCTION()
268 # A convenience function for marking desired components
269 # as found or not
271 function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
272   foreach(COMPONENT ${Boost_FIND_COMPONENTS})
273     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
274     set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
275   endforeach()
276 endfunction()
279 # End functions/macros
280 #  
281 #-------------------------------------------------------------------------------
286 IF(NOT DEFINED Boost_USE_MULTITHREADED)
287     SET(Boost_USE_MULTITHREADED TRUE)
288 ENDIF()
290 if(Boost_FIND_VERSION_EXACT)
291   # The version may appear in a directory with or without the patch
292   # level, even when the patch level is non-zero.
293   set(_boost_TEST_VERSIONS
294     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
295     "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
296 else(Boost_FIND_VERSION_EXACT)
297   # The user has not requested an exact version.  Among known
298   # versions, find those that are acceptable to the user request.
299   set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
300     "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"
301     "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
302     "1.34" "1.33.1" "1.33.0" "1.33")
303   set(_boost_TEST_VERSIONS)
304   if(Boost_FIND_VERSION)
305     set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
306     # Select acceptable versions.
307     foreach(version ${_Boost_KNOWN_VERSIONS})
308       if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
309         # This version is high enough.
310         list(APPEND _boost_TEST_VERSIONS "${version}")
311       elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
312         # This version is a short-form for the requested version with
313         # the patch level dropped.
314         list(APPEND _boost_TEST_VERSIONS "${version}")
315       endif()
316     endforeach(version)
317   else(Boost_FIND_VERSION)
318     # Any version is acceptable.
319     set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
320   endif(Boost_FIND_VERSION)
321 endif(Boost_FIND_VERSION_EXACT)
323 # The reason that we failed to find Boost. This will be set to a
324 # user-friendly message when we fail to find some necessary piece of
325 # Boost.
326 set(Boost_ERROR_REASON)
328 SET( _boost_IN_CACHE TRUE)
329 IF(Boost_INCLUDE_DIR)
331   # On versions < 1.35, remove the System library from the considered list
332   # since it wasn't added until 1.35.
333   if(Boost_VERSION AND Boost_FIND_COMPONENTS)
334      math(EXPR _boost_maj "${Boost_VERSION} / 100000")
335      math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000")
336      if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35)
337        list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
338      endif()
339   endif()
341   FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
342     STRING(TOUPPER ${COMPONENT} COMPONENT)
343     IF(NOT Boost_${COMPONENT}_FOUND)
344       SET( _boost_IN_CACHE FALSE)
345     ENDIF(NOT Boost_${COMPONENT}_FOUND)
346   ENDFOREACH(COMPONENT)
347 ELSE(Boost_INCLUDE_DIR)
348   SET( _boost_IN_CACHE FALSE)
349 ENDIF(Boost_INCLUDE_DIR)
351 IF (_boost_IN_CACHE)
352   # in cache already
353   SET(Boost_FOUND TRUE)
354   FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
355     STRING(TOUPPER ${COMPONENT} COMPONENT)
356     _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
357     SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
358   ENDFOREACH(COMPONENT)
359   SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
360   IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
361     MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
362     MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
363     MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
364   ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
365   if(Boost_DEBUG)
366       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
367                      "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} "
368                      "is already in the cache.  For debugging messages, please clear the cache.")
369   endif()
370 ELSE (_boost_IN_CACHE)
371   # Need to search for boost
372   if(Boost_DEBUG)
373     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
374                    "Boost not in cache")
375     # Output some of their choices
376     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
377                    "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
378     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
379                    "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
380     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
381                    "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
382   endif()
384   IF(WIN32)
385     # In windows, automatic linking is performed, so you do not have
386     # to specify the libraries.  If you are linking to a dynamic
387     # runtime, then you can choose to link to either a static or a
388     # dynamic Boost library, the default is to do a static link.  You
389     # can alter this for a specific library "whatever" by defining
390     # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
391     # linked dynamically.  Alternatively you can force all Boost
392     # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
393   
394     # This feature can be disabled for Boost library "whatever" by
395     # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
396     # BOOST_ALL_NO_LIB.
397   
398     # If you want to observe which libraries are being linked against
399     # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
400     # code to emit a #pragma message each time a library is selected
401     # for linking.
402     SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS 
403       "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
404   ENDIF(WIN32)
406   SET(_boost_INCLUDE_SEARCH_DIRS
407     C:/boost/include
408     C:/boost
409     "$ENV{ProgramFiles}/boost/include"
410     "$ENV{ProgramFiles}/boost"
411     /sw/local/include
412   )
414   # If BOOST_ROOT was defined in the environment, use it.
415   if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
416     set(BOOST_ROOT $ENV{BOOST_ROOT})
417   endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
419   # If BOOSTROOT was defined in the environment, use it.
420   if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
421     set(BOOST_ROOT $ENV{BOOSTROOT})
422   endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
424   # If BOOST_INCLUDEDIR was defined in the environment, use it.
425   IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
426     set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
427   ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
428   
429   # If BOOST_LIBRARYDIR was defined in the environment, use it.
430   IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
431     set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
432   ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
433   
434   IF( BOOST_ROOT )
435     file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
436   ENDIF( BOOST_ROOT )
438   if(Boost_DEBUG)
439     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
440                    "Declared as CMake or Environmental Variables:")
441     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
442                    "  BOOST_ROOT = ${BOOST_ROOT}")
443     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
444                    "  BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
445     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
446                    "  BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
447     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
448                    "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
449   endif()
451   IF( BOOST_ROOT )
452     SET(_boost_INCLUDE_SEARCH_DIRS 
453       ${BOOST_ROOT}/include 
454       ${BOOST_ROOT}
455       ${_boost_INCLUDE_SEARCH_DIRS})
456   ENDIF( BOOST_ROOT )
458   IF( BOOST_INCLUDEDIR )
459     file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
460     SET(_boost_INCLUDE_SEARCH_DIRS 
461       ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
462   ENDIF( BOOST_INCLUDEDIR )
464   # ------------------------------------------------------------------------
465   #  Search for Boost include DIR 
466   # ------------------------------------------------------------------------
467   # Try to find Boost by stepping backwards through the Boost versions
468   # we know about.
469   IF( NOT Boost_INCLUDE_DIR )
470     # Build a list of path suffixes for each version.
471     SET(_boost_PATH_SUFFIXES)
472     FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
473       # Add in a path suffix, based on the required version, ideally
474       # we could read this from version.hpp, but for that to work we'd
475       # need to know the include dir already
476       set(_boost_BOOSTIFIED_VERSION)
478       # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
479       IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
480           STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" 
481             _boost_BOOSTIFIED_VERSION ${_boost_VER})
482       ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
483           STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" 
484             _boost_BOOSTIFIED_VERSION ${_boost_VER})
485       ENDIF()
486       
487       list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
488       if(WIN32)
489         # For BoostPro's underscores (and others?)
490         list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
491       endif()
493     ENDFOREACH(_boost_VER)
494       
495     if(Boost_DEBUG)
496       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
497                      "Include debugging info:")
498       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
499                      "  _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
500       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
501                      "  _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
502     endif()
504     # Look for a standard boost header file.
505     FIND_PATH(Boost_INCLUDE_DIR
506       NAMES         boost/config.hpp
507       HINTS         ${_boost_INCLUDE_SEARCH_DIRS}
508       PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
509       )
510   ENDIF( NOT Boost_INCLUDE_DIR )
511   
512   # ------------------------------------------------------------------------
513   #  Extract version information from version.hpp
514   # ------------------------------------------------------------------------
516   IF(Boost_INCLUDE_DIR)
517     # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
518     # Read the whole file:
519     #
520     SET(BOOST_VERSION 0)
521     SET(BOOST_LIB_VERSION "")
522     FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
523     if(Boost_DEBUG)
524       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
525                      "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
526     endif()
527   
528     STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
529     STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
530   
531     SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
532     SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
533     
534     IF(NOT "${Boost_VERSION}" STREQUAL "0")
535       MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
536       MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
537       MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
539       set(Boost_ERROR_REASON
540           "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
541     ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
542     if(Boost_DEBUG)
543       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
544                      "version.hpp reveals boost "
545                      "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
546     endif()
547   ELSE(Boost_INCLUDE_DIR)
548     set(Boost_ERROR_REASON
549       "${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.")
550   ENDIF(Boost_INCLUDE_DIR)
551   
552   # ------------------------------------------------------------------------
553   #  Suffix initialization and compiler suffix detection.
554   # ------------------------------------------------------------------------
556   # Setting some more suffixes for the library
557   SET (Boost_LIB_PREFIX "")
558   if ( WIN32 AND Boost_USE_STATIC_LIBS )
559     SET (Boost_LIB_PREFIX "lib")
560   endif()
562   if (Boost_COMPILER)
563     set(_boost_COMPILER ${Boost_COMPILER})
564     if(Boost_DEBUG)
565       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
566                      "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
567     endif()
568   else(Boost_COMPILER)
569     # Attempt to guess the compiler suffix
570     # NOTE: this is not perfect yet, if you experience any issues
571     # please report them and use the Boost_COMPILER variable
572     # to work around the problems.
573     if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
574         OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" 
575         OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
576       if(WIN32)
577         set (_boost_COMPILER "-iw")
578       else()
579         set (_boost_COMPILER "-il")
580       endif()
581     elseif (MSVC90)
582       SET (_boost_COMPILER "-vc90")
583     elseif (MSVC10)
584       SET (_boost_COMPILER "-vc100")
585     elseif (MSVC80)
586       SET (_boost_COMPILER "-vc80")
587     elseif (MSVC71)
588       SET (_boost_COMPILER "-vc71")
589     elseif (MSVC70) # Good luck!
590       SET (_boost_COMPILER "-vc7") # yes, this is correct
591     elseif (MSVC60) # Good luck!
592       SET (_boost_COMPILER "-vc6") # yes, this is correct
593     elseif (BORLAND)
594       SET (_boost_COMPILER "-bcb")
595     elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
596       set(_boost_COMPILER "-sw")
597     elseif (MINGW)
598       if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
599           SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34
600       else()
601         _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
602         SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
603       endif()
604     elseif (UNIX)
605       if (CMAKE_COMPILER_IS_GNUCXX)
606         if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
607           SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34
608         else()
609           _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION)
610           # Determine which version of GCC we have.
611           IF(APPLE)
612             IF(Boost_MINOR_VERSION)
613               IF(${Boost_MINOR_VERSION} GREATER 35)
614                 # In Boost 1.36.0 and newer, the mangled compiler name used
615                 # on Mac OS X/Darwin is "xgcc".
616                 SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
617               ELSE(${Boost_MINOR_VERSION} GREATER 35)
618                 # In Boost <= 1.35.0, there is no mangled compiler name for
619                 # the Mac OS X/Darwin version of GCC.
620                 SET(_boost_COMPILER "")
621               ENDIF(${Boost_MINOR_VERSION} GREATER 35)
622             ELSE(Boost_MINOR_VERSION)
623               # We don't know the Boost version, so assume it's
624               # pre-1.36.0.
625               SET(_boost_COMPILER "")
626             ENDIF(Boost_MINOR_VERSION)
627           ELSE()
628             SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
629           ENDIF()
630         endif()
631       endif (CMAKE_COMPILER_IS_GNUCXX)
632     endif()
633     if(Boost_DEBUG)
634       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
635         "guessed _boost_COMPILER = ${_boost_COMPILER}")
636     endif()
637   endif(Boost_COMPILER)
640   if(${Boost_MINOR_VERSION} GREATER 41 AND NOT WIN32 AND NOT APPLE)
641       set (_boost_MULTITHREADED "")
642   else()
643     SET (_boost_MULTITHREADED "-mt")
644     if( NOT Boost_USE_MULTITHREADED )
645       set (_boost_MULTITHREADED "")
646     endif()
647   endif()
649   if(Boost_DEBUG)
650     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
651       "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
652   endif()
654   SET( _boost_STATIC_TAG "")
655   set( _boost_ABI_TAG "")
656   IF (WIN32)
657     IF(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
658             OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
659       SET (_boost_ABI_TAG "g")
660     ENDIF()
661     IF( Boost_USE_STATIC_LIBS )
662       SET( _boost_STATIC_TAG "-s")
663     ENDIF( Boost_USE_STATIC_LIBS )
664   ENDIF(WIN32)
665   SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")
666   if(Boost_DEBUG)
667     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
668       "_boost_STATIC_TAG = ${_boost_STATIC_TAG}")
669     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
670       "_boost_ABI_TAG = ${_boost_ABI_TAG}")
671   endif()
673   # ------------------------------------------------------------------------
674   #  Begin finding boost libraries
675   # ------------------------------------------------------------------------
677   SET(_boost_LIBRARIES_SEARCH_DIRS
678     ${Boost_INCLUDE_DIR}/lib
679     ${Boost_INCLUDE_DIR}/../lib
680     C:/boost/lib
681     C:/boost
682     "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
683     "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
684     "$ENV{ProgramFiles}/boost/lib"
685     "$ENV{ProgramFiles}/boost"
686     /sw/local/lib
687   )
688   IF( BOOST_ROOT )
689     SET(_boost_LIBRARIES_SEARCH_DIRS 
690       ${BOOST_ROOT}/lib 
691       ${BOOST_ROOT}/stage/lib 
692       ${_boost_LIBRARIES_SEARCH_DIRS})
693   ENDIF( BOOST_ROOT )
695   IF( BOOST_LIBRARYDIR )
696     file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
697     SET(_boost_LIBRARIES_SEARCH_DIRS 
698       ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS})
699   ENDIF( BOOST_LIBRARYDIR )
701   if(Boost_DEBUG)
702     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
703       "_boost_LIBRARIES_SEARCH_DIRS = ${_boost_LIBRARIES_SEARCH_DIRS}")
704   endif()
706   FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
707     STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
708     SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
709     SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
710     SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
712     # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
713     IF( Boost_USE_STATIC_LIBS )
714       SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
715       IF(WIN32)
716         SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
717       ELSE(WIN32)
718         SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
719       ENDIF(WIN32)
720     ENDIF( Boost_USE_STATIC_LIBS )
722     FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
723         NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
724                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
725                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
726                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
727                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
728                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}
729                ${Boost_LIB_PREFIX}boost_${COMPONENT}
730         HINTS  ${_boost_LIBRARIES_SEARCH_DIRS}
731     )
733     FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
734         NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
735                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
736                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
737                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
738                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}
739                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}
740                ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG}
741         HINTS  ${_boost_LIBRARIES_SEARCH_DIRS}
742     )
744     _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
745     IF( Boost_USE_STATIC_LIBS )
746       SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
747     ENDIF( Boost_USE_STATIC_LIBS )
748   ENDFOREACH(COMPONENT)
749   # ------------------------------------------------------------------------
750   #  End finding boost libraries
751   # ------------------------------------------------------------------------
753   SET(Boost_INCLUDE_DIRS
754     ${Boost_INCLUDE_DIR}
755   )
757   SET(Boost_FOUND FALSE)
758   IF(Boost_INCLUDE_DIR)
759     SET( Boost_FOUND TRUE )
761     # Check the version of Boost against the requested version.
762     if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
763       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")
764     endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
765     if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
766       set( Boost_FOUND FALSE )
767       set(_Boost_VERSION_AGE "old")
768     elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
769       if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
770         set( Boost_FOUND FALSE )
771         set(_Boost_VERSION_AGE "old")
772       elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
773         if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
774           set( Boost_FOUND FALSE )
775           set(_Boost_VERSION_AGE "old")
776         endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
777       endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
778     endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
780     if (NOT Boost_FOUND)
781       _Boost_MARK_COMPONENTS_FOUND(OFF)
782     endif()
784     if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
785       # If the user requested an exact version of Boost, check
786       # that. We already know that the Boost version we have is >= the
787       # requested version.
788       set(_Boost_VERSION_AGE "new")
790       # If the user didn't specify a patchlevel, it's 0.
791       if (NOT Boost_FIND_VERSION_PATCH)
792         set(Boost_FIND_VERSION_PATCH 0)
793       endif (NOT Boost_FIND_VERSION_PATCH)
794       
795       # We'll set Boost_FOUND true again if we have an exact version match.
796       set(Boost_FOUND FALSE)
797       _Boost_MARK_COMPONENTS_FOUND(OFF)
798       if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
799         if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
800           if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
801             set( Boost_FOUND TRUE )
802             _Boost_MARK_COMPONENTS_FOUND(ON)
803           endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
804         endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
805       endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
806     endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
808     if(NOT Boost_FOUND)
809       # State that we found a version of Boost that is too new or too old.
810       set(Boost_ERROR_REASON
811         "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
812       if (Boost_FIND_VERSION_PATCH)
813         set(Boost_ERROR_REASON 
814           "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
815       endif (Boost_FIND_VERSION_PATCH)
816       if (NOT Boost_FIND_VERSION_EXACT)
817         set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
818       endif (NOT Boost_FIND_VERSION_EXACT)
819       set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
820     endif (NOT Boost_FOUND)
822     # Always check for missing components
823     set(_boost_CHECKED_COMPONENT FALSE)
824     set(_Boost_MISSING_COMPONENTS "")
825     foreach(COMPONENT ${Boost_FIND_COMPONENTS})
826       string(TOUPPER ${COMPONENT} COMPONENT)
827       set(_boost_CHECKED_COMPONENT TRUE)
828       if(NOT Boost_${COMPONENT}_FOUND)
829         string(TOLOWER ${COMPONENT} COMPONENT)
830         list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
831         set( Boost_FOUND FALSE)
832       endif(NOT Boost_${COMPONENT}_FOUND)
833     endforeach(COMPONENT)
835     if(Boost_DEBUG)
836       message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
837     endif()
839     if (_Boost_MISSING_COMPONENTS)
840       # We were unable to find some libraries, so generate a sensible
841       # error message that lists the libraries we were unable to find.
842       set(Boost_ERROR_REASON
843         "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
844       foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
845         set(Boost_ERROR_REASON
846           "${Boost_ERROR_REASON}        boost_${COMPONENT}\n")
847       endforeach(COMPONENT)
849       list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
850       list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
851       if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
852         set(Boost_ERROR_REASON
853           "${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.")
854       else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
855         set(Boost_ERROR_REASON
856           "${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.")
857       endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
858     endif (_Boost_MISSING_COMPONENTS)
860     IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
861       # Compatibility Code for backwards compatibility with CMake
862       # 2.4's FindBoost module.
864       # Look for the boost library path.
865       # Note that the user may not have installed any libraries
866       # so it is quite possible the Boost_LIBRARY_PATH may not exist.
867       SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
868     
869       IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
870         GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
871       ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
872     
873       IF("${_boost_LIB_DIR}" MATCHES "/include$")
874         # Strip off the trailing "/include" in the path.
875         GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
876       ENDIF("${_boost_LIB_DIR}" MATCHES "/include$")
877     
878       IF(EXISTS "${_boost_LIB_DIR}/lib")
879         SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
880       ELSE(EXISTS "${_boost_LIB_DIR}/lib")
881         IF(EXISTS "${_boost_LIB_DIR}/stage/lib")
882           SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
883         ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib")
884           SET(_boost_LIB_DIR "")
885         ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib")
886       ENDIF(EXISTS "${_boost_LIB_DIR}/lib")
887     
888       IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
889         SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
890       ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
892     ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
894   ELSE(Boost_INCLUDE_DIR)
895     SET( Boost_FOUND FALSE)
896   ENDIF(Boost_INCLUDE_DIR)
898   IF (Boost_FOUND)
899       IF (NOT Boost_FIND_QUIETLY)
900         MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
901         if(Boost_FIND_COMPONENTS)
902           message(STATUS "Found the following Boost libraries:")
903         endif()
904       ENDIF(NOT Boost_FIND_QUIETLY)
905       FOREACH ( COMPONENT  ${Boost_FIND_COMPONENTS} )
906         STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
907         IF ( Boost_${UPPERCOMPONENT}_FOUND )
908           IF (NOT Boost_FIND_QUIETLY)
909             MESSAGE (STATUS "  ${COMPONENT}")
910           ENDIF(NOT Boost_FIND_QUIETLY)
911           SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
912         ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
913       ENDFOREACH(COMPONENT)
914   else()
915     if(Boost_FIND_REQUIRED)
916       message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
917     else()
918       if(NOT Boost_FIND_QUIETLY)
919         # we opt not to automatically output Boost_ERROR_REASON here as
920         # it could be quite lengthy and somewhat imposing in it's requests
921         # Since Boost is not always a required dependency we'll leave this
922         # up to the end-user.
923         if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
924           message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
925         else()
926           message(STATUS "Could NOT find Boost")
927         endif()
928       endif()
929     endif(Boost_FIND_REQUIRED)
930   endif()
932   # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
933   MARK_AS_ADVANCED(Boost_INCLUDE_DIR
934       Boost_INCLUDE_DIRS
935       Boost_LIBRARY_DIRS
936   )
937 ENDIF(_boost_IN_CACHE)