summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2009-05-14 14:47:17 +0000
committerDouglas Gregor <doug.gregor@gmail.com>2009-05-14 14:47:17 +0000
commite0d6ae268e803f46185df5d0152a44b0b73c606f (patch)
tree6b2478ba1af7727abeadc0601da9f96a5677a8dd /CMakeLists.txt
parent5475323084fee0004379ca5330d04b342dc2152e (diff)
downloadboost-e0d6ae268e803f46185df5d0152a44b0b73c606f.tar.gz
CMake will parse the Boost version from boost/version.hpp
[SVN r52993]
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 15 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 191a6fde9d..684c799833 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,10 +30,21 @@ project(Boost)
##########################################################################
# Version information #
##########################################################################
-set(BOOST_VERSION_MAJOR 1)
-set(BOOST_VERSION_MINOR 40)
-set(BOOST_VERSION_SUBMINOR 0)
-set(BOOST_VERSION "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
+
+# We parse the version information from the boost/version.hpp header.
+file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/boost/version.hpp BOOST_VERSIONSTR
+ REGEX "#define[ ]+BOOST_VERSION[ ]+[0-9]+")
+string(REGEX MATCH "[0-9]+" BOOST_VERSIONSTR ${BOOST_VERSIONSTR})
+if (BOOST_VERSIONSTR)
+ math(EXPR BOOST_VERSION_MAJOR "${BOOST_VERSIONSTR} / 100000")
+ math(EXPR BOOST_VERSION_MINOR "${BOOST_VERSIONSTR} / 100 % 1000")
+ math(EXPR BOOST_VERSION_SUBMINOR "${BOOST_VERSIONSTR} % 100")
+ set(BOOST_VERSION "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
+ message(STATUS "Boost version ${BOOST_VERSION}")
+else()
+ message(FATAL_ERROR
+ "Unable to parse Boost version from ${CMAKE_CURRENT_SOURCE_DIR}/boost/version.hpp")
+endif()
##########################################################################
# Put the libaries and binaries that get built into directories at the