summaryrefslogtreecommitdiffstats
path: root/Modules/FindOpenSceneGraph.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/FindOpenSceneGraph.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/FindOpenSceneGraph.cmake')
-rw-r--r--Modules/FindOpenSceneGraph.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 17ab057..95912fa 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -103,7 +103,8 @@ if(OSG_INCLUDE_DIR)
endif()
if(EXISTS "${_osg_Version_file}")
- file(READ "${_osg_Version_file}" _osg_Version_contents)
+ file(STRINGS "${_osg_Version_file}" _osg_Version_contents
+ REGEX "#define (OSG_VERSION_[A-Z]+|OPENSCENEGRAPH_[A-Z]+_VERSION)[ \t]+[0-9]+")
else()
set(_osg_Version_contents "unknown")
endif()
@@ -130,6 +131,7 @@ if(OSG_INCLUDE_DIR)
message(WARNING "[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
"Failed to parse version number, please report this as a bug")
endif()
+ unset(_osg_Version_contents)
set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}"
CACHE INTERNAL "The version of OSG which was detected")