diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2012-08-19 11:54:56 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2012-08-19 11:54:56 (GMT) |
commit | 4be6783711b2ff510c3449c5de22d35663d8bfc1 (patch) | |
tree | d43959dacd4cf3db3e624d2976468c52e5bf172a /Modules/FindGTK2.cmake | |
parent | d46f8afae98cd8f50cff9915a5a9dc680b9e0518 (diff) | |
download | CMake-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/FindGTK2.cmake')
-rw-r--r-- | Modules/FindGTK2.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index d10b419..1e54cd7 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -114,7 +114,7 @@ # _gtkversion_hdr = Header file to parse #============================================================= function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) - file(READ ${_gtkversion_hdr} _contents) + file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") if(_contents) string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}") string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}") |