summaryrefslogtreecommitdiffstats
path: root/Modules/FindBoost.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2012-08-19 11:54:56 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2012-08-19 11:54:56 (GMT)
commit4be6783711b2ff510c3449c5de22d35663d8bfc1 (patch)
treed43959dacd4cf3db3e624d2976468c52e5bf172a /Modules/FindBoost.cmake
parentd46f8afae98cd8f50cff9915a5a9dc680b9e0518 (diff)
downloadCMake-4be6783711b2ff510c3449c5de22d35663d8bfc1.zip
CMake-4be6783711b2ff510c3449c5de22d35663d8bfc1.tar.gz
CMake-4be6783711b2ff510c3449c5de22d35663d8bfc1.tar.bz2
read less from version headers into variables
Instead of reading the whole file using file(READ) and later matching on the whole file use file(STRINGS ... REGEX) to get only those lines we are interested in at all. This will make the list much smaller (good for debugging) and also the regular expressions will need to match on much smaller strings. Also unset the content variables once they are not used anymore.
Diffstat (limited to 'Modules/FindBoost.cmake')
-rw-r--r--Modules/FindBoost.cmake3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 607e249..17aba1b 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -729,7 +729,7 @@ set(Boost_ERROR_REASON)
#
set(BOOST_VERSION 0)
set(BOOST_LIB_VERSION "")
- file(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
+ file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
@@ -737,6 +737,7 @@ set(Boost_ERROR_REASON)
string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
+ unset(_boost_VERSION_HPP_CONTENTS)
set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")