From 4be6783711b2ff510c3449c5de22d35663d8bfc1 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Sun, 19 Aug 2012 13:54:56 +0200 Subject: 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. --- Modules/FindGTK2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/FindGTK2.cmake') diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index d10b4190e3..1e54cd7e27 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}") -- cgit v1.2.1