summaryrefslogtreecommitdiff
path: root/Modules/FindQt3.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2012-08-19 13:54:56 +0200
committerRolf Eike Beer <eike@sf-mail.de>2012-08-19 13:54:56 +0200
commit4be6783711b2ff510c3449c5de22d35663d8bfc1 (patch)
treed43959dacd4cf3db3e624d2976468c52e5bf172a /Modules/FindQt3.cmake
parentd46f8afae98cd8f50cff9915a5a9dc680b9e0518 (diff)
downloadcmake-4be6783711b2ff510c3449c5de22d35663d8bfc1.tar.gz
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/FindQt3.cmake')
-rw-r--r--Modules/FindQt3.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 15fbc0bb5e..28af7ada8a 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -74,9 +74,9 @@ endif()
if(QT_INCLUDE_DIR)
#extract the version string from qglobal.h
- file(READ ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H)
- string(REGEX MATCH "#define[\t ]+QT_VERSION_STR[\t ]+\"[0-9]+.[0-9]+.[0-9]+[a-z]*\"" QGLOBAL_H "${QGLOBAL_H}")
+ file(STRINGS ${QT_INCLUDE_DIR}/qglobal.h QGLOBAL_H REGEX "#define[\t ]+QT_VERSION_STR[\t ]+\"[0-9]+.[0-9]+.[0-9]+[a-z]*\"")
string(REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+[a-z]*)\".*" "\\1" qt_version_str "${QGLOBAL_H}")
+ unset(QGLOBAL_H)
# Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the
# version X.Y.Z, so we need to remove the dots from version