Switch to a new FindBoost
[mussa.git] / makelib / FindBoost.cmake
1 # - Try to find Boost include dirs and libraries
2 # Usage of this module as follows:
3 #
4 #     FIND_PACKAGE( Boost 1.34.1 COMPONENTS date_time filesystem iostreams ... )
5 #
6 # The Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
7 # boost version numbers that should be taken into account when searching
8 # for the libraries. Unfortunately boost puts the version number into the
9 # actual filename for the libraries, so this might be needed in the future
10 # when new boost versions are released.
11 #
12 # Currently this module searches for the following version numbers:
13 # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1
14 #
15 # The components list needs to be the actual names of boost libraries, that is
16 # the part of the actual library files that differ on different libraries. So
17 # its "date_time" for "libboost_date_time...". Anything else will result in
18 # errors
19 #
20 # You can provide a minimum version number that should be used. If you provide this 
21 # version number and specify the REQUIRED attribute, this module will fail if it
22 # can't find the specified or a later version. If you specify a version number this is 
23 # automatically put into the considered list of version numbers and thus doesn't need 
24 # to be specified in the Boost_ADDITIONAL_VERSIONS variable
25 #
26 # Variables used by this module, they can change the default behaviour and need to be
27 # set before calling find_package:
28 #  Boost_USE_MULTITHREAD         Can be set to OFF to use the non-multithreaded
29 #                                boost libraries. Defaults to ON.
30 #  Boost_ADDITIONAL_VERSIONS     A list of version numbers to use for searching
31 #                                the boost include directory. The default list
32 #                                of version numbers is:
33 #                                1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1
34 #                                If you want to look for an older or newer
35 #                                version set this variable to a list of
36 #                                strings, where each string contains a number, i.e.
37 #                                SET(Boost_ADDITIONAL_VERSIONS "0.99.0" "1.35.0")
38 #  Boost_ROOT          Preferred installation prefix for searching for Boost,
39 #                                set this if the module has problems finding the proper Boost
40 #                                installation 
41 #  Boost_INCLUDEDIR              Set this to the include directory of Boost, if the 
42 #                                module has problems finding the proper Boost installation 
43 #  Boost_LIBRARYDIR              Set this to the lib directory of Boost, if the 
44 #                                module has problems finding the proper Boost installation 
45 #
46 #  The last three variables are available also as environment variables
47 #
48 #
49 # Variables defined by this module:
50 #
51 #  Boost_FOUND                System has Boost, this means the include dir was found,
52 #                             as well as all the libraries specified in the COMPONENTS list 
53 #  Boost_INCLUDE_DIRS        Boost include directories, not cached
54 #  Boost_INCLUDE_DIR          This is almost the same as above, but this one is 
55 #                                            cached and may be modified by advanced users
56 #  Boost_LIBRARIES            Link these to use the Boost libraries that you specified, 
57 #                                       not cached 
58 #  Boost_LIBRARY_DIRS         The path to where the Boost library files are. 
59 #  Boost_VERSION              The version number of the boost libraries that have been
60 #                                        found, as in version.hpp from Boost 
61 #  Boost_LIB_VERSION       The version number in filename form as its \
62 #                                       appended to the library filenames 
63 #  Boost_MAJOR_VERSION        major version number of boost 
64 #  Boost_MINOR_VERSION        minor version number of boost
65 #  Boost_SUBMINOR_VERSION     subminor version number of boost
66
67 # For each component you list the following variables are set.
68 # ATTENTION: The component names need to be in lower case, just as the boost
69 # library names however the cmake variables use upper case for the component
70 # part. So you'd get Boost_SERIALIZATION_FOUND for example.
71 #
72 #  Boost_${COMPONENT}_FOUND             True IF the Boost library "component" was 
73 #                                                               found
74 #  Boost_${COMPONENT}_LIBRARY           The absolute path of the Boost library \
75 #                                                              "component". 
76 #  Boost_${COMPONENT}_LIBRARY_DEBUG     The absolute path of the debug \
77 #                                                                     version of the  Boost library "component".
78 #  Boost_${COMPONENT}_LIBRARY_RELEASE   The absolute path of the release version of 
79 #                                                                     the Boost library "component"
80 #
81 #  Copyright (c) 2006-2008 Andreas Schneider <mail@cynapses.org>
82 #  Copyright (c) 2007      Wengo
83 #  Copyright (c) 2007      Mike Jackson
84 #  Copyright (c) 2008      Andreas Pakulat <apaku@gmx.de>
85 #
86 #  Redistribution AND use is allowed according to the terms of the New
87 #  BSD license.
88 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
89 #
90
91 # this module required CMake 2.5 for the Boost_FIND_VERSION stuff
92 CMAKE_MINIMUM_REQUIRED(VERSION "2.4" FATAL_ERROR)
93
94 # MESSAGE(STATUS "Finding Boost libraries.... ")
95
96 OPTION(Boost_USE_MULTITHREAD "Use the multithreaded versions of the boost libraries" ON)
97
98 SET( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.33" "1.33.0" "1.33.1" "1.34" "1.34.0" "1.34.1" )
99
100
101 ############################################
102 #
103 # Check the existence of the libraries.
104 #
105 ############################################
106 # This macro was taken directly from the FindQt4.cmake file that is included
107 # with the CMake distribution. This is NOT my work. All work was done by the
108 # original authors of the FindQt4.cmake file. Only minor modifications were
109 # made to remove references to Qt and make this file more generally applicable
110 #########################################################################
111
112 MACRO (_Boost_ADJUST_LIB_VARS basename)
113   IF (Boost_INCLUDE_DIR )
114     #MESSAGE(STATUS "Adjusting ${basename} ")
115
116     IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
117       # if the generator supports configuration types then set
118       # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
119       IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
120         SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})  
121       ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
122         # if there are no configuration types and CMAKE_BUILD_TYPE has no value
123         # then just use the release libraries
124         SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
125       ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
126       SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})  
127 ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
128
129     # if only the release version was found, set the debug variable also to the release version 
130     IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
131       SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
132       SET(Boost_${basename}_LIBRARY       ${Boost_${basename}_LIBRARY_RELEASE})
133       SET(Boost_${basename}_LIBRARIES     ${Boost_${basename}_LIBRARY_RELEASE})
134     ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
135
136     # if only the debug version was found, set the release variable also to the debug version  
137     IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
138       SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
139       SET(Boost_${basename}_LIBRARY         ${Boost_${basename}_LIBRARY_DEBUG})
140       SET(Boost_${basename}_LIBRARIES       ${Boost_${basename}_LIBRARY_DEBUG})
141     ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
142     
143     IF (Boost_${basename}_LIBRARY)
144       SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
145       GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS "${Boost_${basename}_LIBRARY}" PATH)
146       SET(Boost_${basename}_FOUND 1)
147     ENDIF (Boost_${basename}_LIBRARY)
148
149   ENDIF (Boost_INCLUDE_DIR )
150   # Make variables changeble to the advanced user
151   MARK_AS_ADVANCED(
152       Boost_${basename}_LIBRARY
153       Boost_${basename}_LIBRARY_RELEASE
154       Boost_${basename}_LIBRARY_DEBUG
155   )
156 ENDMACRO (_Boost_ADJUST_LIB_VARS)
157
158 #------------------------------------------------------------------
159
160 SET( _boost_IN_CACHE TRUE)
161
162 IF(Boost_INCLUDE_DIR)
163   FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
164     STRING(TOUPPER ${COMPONENT} COMPONENT)
165     IF(NOT Boost_${COMPONENT}_FOUND)
166       SET( _boost_IN_CACHE FALSE)
167     ENDIF(NOT Boost_${COMPONENT}_FOUND)
168   ENDFOREACH(COMPONENT)
169 ELSE(Boost_INCLUDE_DIR)
170   SET( _boost_IN_CACHE FALSE)
171 ENDIF(Boost_INCLUDE_DIR)
172
173 IF(_boost_IN_CACHE)
174   # in cache already
175   SET(Boost_FOUND TRUE)
176   FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
177     STRING(TOUPPER ${COMPONENT} COMPONENT)
178     _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
179   ENDFOREACH(COMPONENT)
180   SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
181 ELSE(_boost_IN_CACHE)
182   # Need to search for boost
183
184   SET(_boost_INCLUDE_SEARCH_DIRS
185     C:/boost/include
186     "C:/Program Files/boost/boost_${Boost_MINIMUM_VERSION}"
187     # D: is very often the cdrom drive, IF you don't have a
188     # cdrom inserted it will popup a very annoying dialog
189     #D:/boost/include
190     /sw/local/include
191   )
192
193   SET(_boost_LIBRARIES_SEARCH_DIRS
194     C:/boost/lib
195     "C:/Program Files/boost/boost_${Boost_MINIMUM_VERSION}/lib"
196     /sw/local/lib
197   )
198
199   IF( NOT $ENV{Boost_ROOT} STREQUAL "" )
200     SET(_boost_INCLUDE_SEARCH_DIRS $ENV{Boost_ROOT}/include ${_boost_INCLUDE_SEARCH_DIRS})  
201     SET(_boost_LIBRARIES_SEARCH_DIRS $ENV{Boost_ROOT}/lib ${_boost_INCLUDE_SEARCH_DIRS})  
202   ENDIF( NOT $ENV{Boost_ROOT} STREQUAL "" )
203
204   IF( NOT $ENV{Boost_INCLUDEDIR} STREQUAL "" )
205     SET(_boost_INCLUDE_SEARCH_DIRS $ENV{Boost_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})  
206   ENDIF( NOT $ENV{Boost_INCLUDEDIR} STREQUAL "" )
207
208   IF( NOT $ENV{Boost_LIBRARYDIR} STREQUAL "" )
209     SET(_boost_LIBRARIES_SEARCH_DIRS $ENV{Boost_LIBRARYDIR} ${_boost_INCLUDE_SEARCH_DIRS})  
210   ENDIF( NOT $ENV{Boost_LIBRARYDIR} STREQUAL "" )
211
212   IF( Boost_ROOT )
213     SET(_boost_INCLUDE_SEARCH_DIRS ${Boost_ROOT}/include ${_boost_INCLUDE_SEARCH_DIRS})  
214     SET(_boost_LIBRARIES_SEARCH_DIRS ${Boost_ROOT}/lib ${_boost_LIBRARIES_SEARCH_DIRS}) 
215    ENDIF( Boost_ROOT )
216
217   IF( Boost_INCLUDEDIR )
218     SET(_boost_INCLUDE_SEARCH_DIRS ${Boost_INCLUDEDIR}/include ${_boost_INCLUDE_SEARCH_DIRS})  
219   ENDIF( Boost_INCLUDEDIR )
220
221   IF( Boost_LIBRARYDIR )
222     SET(_boost_LIBRARIES_SEARCH_DIRS ${Boost_LIBRARYDIR}/include ${_boost_LIBRARIES_SEARCH_DIRS})  
223   ENDIF( Boost_LIBRARYDIR )
224
225   FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
226     IF( NOT Boost_INCLUDE_DIR )
227
228       # Add in a path suffix, based on the required version, ideally we could
229       # read this from version.hpp, but for that to work we'd need to know the 
230       # include dir already
231       SET(_boost_PATH_SUFFIX
232         boost-${_boost_VER}
233       )
234       STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
235
236
237       FIND_PATH(Boost_INCLUDE_DIR
238           NAMES         boost/config.hpp
239           PATHS         ${_boost_INCLUDE_SEARCH_DIRS}
240           PATH_SUFFIXES ${_boost_PATH_SUFFIX}
241       )
242  
243       IF(Boost_INCLUDE_DIR)
244         # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
245         # Read the whole file:
246         #
247         SET(BOOST_VERSION 0)
248         SET(BOOST_LIB_VERSION "")
249         FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)  
250         STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
251         STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")  
252         SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE STRING "The library version string for boost libraries")
253         SET(Boost_VERSION ${Boost_VERSION} CACHE STRING "The version number for boost libraries")  
254         IF(NOT "${Boost_VERSION}" STREQUAL "0")
255           MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
256           MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
257           MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
258   
259         ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
260       ENDIF(Boost_INCLUDE_DIR)
261
262     ENDIF( NOT Boost_INCLUDE_DIR )
263   ENDFOREACH(_boost_VER)
264
265   #Setting some more suffixes for the library
266   SET (Boost_LIB_PREFIX "")
267   IF ( WIN32 )
268     SET (Boost_LIB_PREFIX "lib")
269   ENDIF ( WIN32 )
270   SET (_boost_COMPILER "-gcc")
271   IF (MSVC71)
272     SET (_boost_COMPILER "-vc71")
273   ENDIF(MSVC71)
274    IF (MSVC80)
275     SET (_boost_COMPILER "-vc80")
276   ENDIF(MSVC80)
277   IF (MINGW)
278     SET (_boost_COMPILER "-mgw")
279   ENDIF(MINGW)
280   IF (CYGWIN)
281     SET (_boost_COMPILER "-gcc")
282   ENDIF (CYGWIN)
283   IF (UNIX)
284     IF (NOT CMAKE_COMPILER_IS_GNUCC)
285       # This is for the intel compiler
286       SET (_boost_COMPILER "-il")
287     ELSE (NOT CMAKE_COMPILER_IS_GNUCC)
288       #find out the version of gcc being used.
289       EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
290           ARGS --version
291           OUTPUT_VARIABLE _boost_COMPILER_VERSION
292       )
293       STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.[0-9] .*" "\\1\\2"
294              _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
295       SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
296     ENDIF (NOT CMAKE_COMPILER_IS_GNUCC)
297   ENDIF(UNIX)
298
299   SET (_boost_MULTITHREADED "-mt")
300
301   IF( NOT Boost_USE_MULTITHREADED )
302     SET (_boost_MULTITHREADED "")
303   ENDIF( NOT Boost_USE_MULTITHREADED )
304
305   SET( _boost_STATIC_TAG "")
306   IF (WIN32)
307     SET (_boost_ABI_TAG "g")
308     SET( _boost_STATIC_TAG "-s")
309   ENDIF(WIN32)
310   SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")
311
312   # ----------------------------------------------------------------
313   #  Begin finding boost libraries
314   # ----------------------------------------------------------------
315   FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
316     STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
317     SET( Boost_{UPPERCOMPONENT}_LIBRARY FALSE)
318     SET( Boost_{UPPERCOMPONENT}_LIBRARY_RELEASE FALSE)
319     SET( Boost_{UPPERCOMPONENT}_LIBRARY_DEBUG FALSE)
320     FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
321         NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
322                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
323                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
324                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}  ${Boost_LIB_PREFIX}boost_${COMPONENT}
325         PATHS  ${_boost_LIBRARIES_SEARCH_DIRS}
326         NO_DEFAULT_PATH
327     )
328
329     IF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE} )
330       FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
331           NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
332                  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
333                  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
334                  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}  ${Boost_LIB_PREFIX}boost_${COMPONENT}
335       )
336     ENDIF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE} )
337
338     FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
339         NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
340                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
341                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}
342                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}  ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG}
343         PATHS  ${_boost_LIBRARIES_SEARCH_DIRS}
344         NO_DEFAULT_PATH
345     )
346
347     IF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG} )
348       FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
349           NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
350                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
351                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}
352                ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}  ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG}
353       )
354     ENDIF( NOT ${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG} )
355     _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
356   ENDFOREACH(COMPONENT)
357   # --------------------------------------------------------------
358   #  End finding boost libraries
359   # --------------------------------------------------------------
360
361   SET(Boost_INCLUDE_DIRS
362     ${Boost_INCLUDE_DIR}
363   )
364
365   #MESSAGE(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
366   #MESSAGE(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
367
368   SET(Boost_FOUND FALSE)
369   IF(Boost_INCLUDE_DIR)
370     SET( Boost_FOUND TRUE )
371     IF( Boost_FIND_VERSION_MAJOR AND Boost_VERSION_MAJOR LESS "${Boost_FIND_VERSION_MAJOR}" )  
372         SET( Boost_FOUND FALSE )
373     ELSE( Boost_FIND_VERSION_MAJOR AND Boost_VERSION_MAJOR LESS "${Boost_FIND_VERSION_MAJOR}" )
374       IF( Boost_FIND_VERSION_MINOR AND Boost_VERSION_MINOR LESS "${Boost_FIND_VERSION_MINOR}" )  
375           SET( Boost_FOUND FALSE )
376       ELSE( Boost_FIND_VERSION_MINOR AND Boost_VERSION_MINOR LESS "${Boost_FIND_VERSION_MINOR}" )
377         IF( Boost_FIND_VERSION_PATCH AND Boost_VERSION_SUBMINOR LESS "${Boost_FIND_VERSION_PATCH}" )  
378             SET( Boost_FOUND FALSE )
379         ENDIF( Boost_FIND_VERSION_PATCH AND Boost_VERSION_SUBMINOR LESS "${Boost_FIND_VERSION_PATCH}" )
380       ENDIF( Boost_FIND_VERSION_MINOR AND Boost_VERSION_MINOR LESS "${Boost_FIND_VERSION_MINOR}" )
381     ENDIF( Boost_FIND_VERSION_MAJOR AND Boost_VERSION_MAJOR LESS "${Boost_FIND_VERSION_MAJOR}" )
382     FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
383       STRING(TOUPPER ${COMPONENT} COMPONENT)
384       IF(NOT Boost_${COMPONENT}_FOUND)
385         SET( Boost_FOUND FALSE)
386       ENDIF(NOT Boost_${COMPONENT}_FOUND)
387     ENDFOREACH(COMPONENT)
388   ELSE(Boost_INCLUDE_DIR)
389     SET( Boost_FOUND FALSE)
390   ENDIF(Boost_INCLUDE_DIR)
391
392   IF (Boost_FOUND)
393       IF (NOT Boost_FIND_QUIETLY)
394         MESSAGE(STATUS "Found The Following Boost Libraries:")
395         FOREACH ( COMPONENT  ${Boost_FIND_COMPONENTS} )
396           STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
397           IF ( Boost_${UPPERCOMPONENT}_FOUND )
398             MESSAGE (STATUS "  ${COMPONENT}")
399             SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
400           ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
401         ENDFOREACH(COMPONENT)
402         MESSAGE(STATUS "Boost Version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")  
403       ENDIF(NOT Boost_FIND_QUIETLY)  
404 ELSE (Boost_FOUND)
405       IF (Boost_FIND_REQUIRED)
406         MESSAGE(STATUS "Boost Version required: ${Boost_FIND_VERSION}. Found: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
407
408        MESSAGE(FATAL_ERROR "Couldn't find the Boost libraries and/or include irectory, or 
409 the version found is too old. Please install the Boost libraries AND development 
410 packages. You can set Boost_ROOT, Boost_INCLUDEDIR and Boost_LIBRARYDIR to help find Boost.")  
411   ENDIF(Boost_FIND_REQUIRED)
412 ENDIF(Boost_FOUND)
413
414   # Under Windows, automatic linking is performed, so no need to specify the libraries.  
415 IF (WIN32)
416       SET(Boost_LIBRARIES "")
417   ENDIF(WIN32)
418
419   # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the 
420   #advanced view  
421   MARK_AS_ADVANCED(Boost_INCLUDE_DIRS
422       Boost_LIBRARIES
423       Boost_LIBRARY_DIRS
424   )
425 ENDIF(_boost_IN_CACHE)