summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorPhilip Lowman <philip@yhbt.com>2009-03-13 01:06:08 (GMT)
committerPhilip Lowman <philip@yhbt.com>2009-03-13 01:06:08 (GMT)
commitcd3984eea3afd8c12c11e40b81da7ccaac266261 (patch)
tree8f2bf199bca5d61f929826d33011e589b483d5a7 /Modules
parent3fe6b3ce370ea8916987b4115ca7c0bf72f831b9 (diff)
downloadCMake-cd3984eea3afd8c12c11e40b81da7ccaac266261.zip
CMake-cd3984eea3afd8c12c11e40b81da7ccaac266261.tar.gz
CMake-cd3984eea3afd8c12c11e40b81da7ccaac266261.tar.bz2
STYLE: Moved functions/macros to top of file so main is more readable.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindBoost.cmake108
1 files changed, 61 insertions, 47 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index cc10579..20198af 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -160,48 +160,11 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
-IF(NOT DEFINED Boost_USE_MULTITHREADED)
- SET(Boost_USE_MULTITHREADED TRUE)
-ENDIF()
-
-if(Boost_FIND_VERSION_EXACT)
- # The version may appear in a directory with or without the patch
- # level, even when the patch level is non-zero.
- set(_boost_TEST_VERSIONS
- "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
- "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
-else(Boost_FIND_VERSION_EXACT)
- # The user has not requested an exact version. Among known
- # versions, find those that are acceptable to the user request.
- set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.38.0" "1.38" "1.37.0" "1.37"
- "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
- "1.34" "1.33.1" "1.33.0" "1.33")
- set(_boost_TEST_VERSIONS)
- if(Boost_FIND_VERSION)
- set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
- # Select acceptable versions.
- foreach(version ${_Boost_KNOWN_VERSIONS})
- if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
- # This version is high enough.
- list(APPEND _boost_TEST_VERSIONS "${version}")
- elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
- # This version is a short-form for the requested version with
- # the patch level dropped.
- list(APPEND _boost_TEST_VERSIONS "${version}")
- endif()
- endforeach(version)
- else(Boost_FIND_VERSION)
- # Any version is acceptable.
- set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
- endif(Boost_FIND_VERSION)
-endif(Boost_FIND_VERSION_EXACT)
-# The reason that we failed to find Boost. This will be set to a
-# user-friendly message when we fail to find some necessary piece of
-# Boost.
-set(Boost_ERROR_REASON)
+#-------------------------------------------------------------------------------
+# FindBoost functions & macros
+#
############################################
#
# Check the existence of the libraries.
@@ -211,6 +174,7 @@ set(Boost_ERROR_REASON)
# with the CMake distribution. This is NOT my work. All work was done by the
# original authors of the FindQt4.cmake file. Only minor modifications were
# made to remove references to Qt and make this file more generally applicable
+# And ELSE/ENDIF pairs were removed for readability.
#########################################################################
MACRO (_Boost_ADJUST_LIB_VARS basename)
@@ -220,27 +184,28 @@ MACRO (_Boost_ADJUST_LIB_VARS basename)
# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
- ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ ELSE()
# if there are no configuration types and CMAKE_BUILD_TYPE has no value
# then just use the release libraries
SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
- ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+ ENDIF()
+ # FIXME: This probably should be set for both cases
SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
- ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
+ ENDIF()
# if only the release version was found, set the debug variable also to the release version
IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE})
SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE})
- ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
+ ENDIF()
# if only the debug version was found, set the release variable also to the debug version
IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG})
SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG})
- ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
+ ENDIF()
IF (Boost_${basename}_LIBRARY)
set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
@@ -255,7 +220,7 @@ MACRO (_Boost_ADJUST_LIB_VARS basename)
set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
- ENDIF (Boost_${basename}_LIBRARY)
+ ENDIF(Boost_${basename}_LIBRARY)
ENDIF (Boost_INCLUDE_DIR )
# Make variables changeble to the advanced user
@@ -266,6 +231,8 @@ MACRO (_Boost_ADJUST_LIB_VARS basename)
)
ENDMACRO (_Boost_ADJUST_LIB_VARS)
+#-------------------------------------------------------------------------------
+
#
# Runs compiler with "-dumpversion" and parses major/minor
# version with a regex.
@@ -282,10 +249,57 @@ FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
ENDFUNCTION()
-
+#
+# End functions/macros
+#
#-------------------------------------------------------------------------------
+
+
+IF(NOT DEFINED Boost_USE_MULTITHREADED)
+ SET(Boost_USE_MULTITHREADED TRUE)
+ENDIF()
+
+if(Boost_FIND_VERSION_EXACT)
+ # The version may appear in a directory with or without the patch
+ # level, even when the patch level is non-zero.
+ set(_boost_TEST_VERSIONS
+ "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}"
+ "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+else(Boost_FIND_VERSION_EXACT)
+ # The user has not requested an exact version. Among known
+ # versions, find those that are acceptable to the user request.
+ set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
+ "1.38.0" "1.38" "1.37.0" "1.37"
+ "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
+ "1.34" "1.33.1" "1.33.0" "1.33")
+ set(_boost_TEST_VERSIONS)
+ if(Boost_FIND_VERSION)
+ set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+ # Select acceptable versions.
+ foreach(version ${_Boost_KNOWN_VERSIONS})
+ if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}")
+ # This version is high enough.
+ list(APPEND _boost_TEST_VERSIONS "${version}")
+ elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99")
+ # This version is a short-form for the requested version with
+ # the patch level dropped.
+ list(APPEND _boost_TEST_VERSIONS "${version}")
+ endif()
+ endforeach(version)
+ else(Boost_FIND_VERSION)
+ # Any version is acceptable.
+ set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}")
+ endif(Boost_FIND_VERSION)
+endif(Boost_FIND_VERSION_EXACT)
+
+# The reason that we failed to find Boost. This will be set to a
+# user-friendly message when we fail to find some necessary piece of
+# Boost.
+set(Boost_ERROR_REASON)
+
+
SET( _boost_IN_CACHE TRUE)
IF(Boost_INCLUDE_DIR)
FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})