summaryrefslogtreecommitdiffstats
path: root/Modules/Qt4Macros.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/Qt4Macros.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/Qt4Macros.cmake')
-rw-r--r--Modules/Qt4Macros.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 4324347..95a2176 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -187,15 +187,15 @@ macro (QT4_ADD_RESOURCES outfiles )
if(EXISTS "${infile}")
# parse file for dependencies
# all files are absolute paths or relative to the location of the qrc file
- file(READ "${infile}" _RC_FILE_CONTENTS)
- string(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
- foreach(_RC_FILE ${_RC_FILES})
- string(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
+ file(STRINGS "${infile}" _RC_FILES REGEX "<file[^>]*>[^<]+")
+ foreach(_RC_FILE IN LISTS _RC_FILES)
+ string(REGEX REPLACE "^<file[^>]*>([^<]*)" "\\1" _RC_FILE "${_RC_FILE}")
if(NOT IS_ABSOLUTE "${_RC_FILE}")
set(_RC_FILE "${rc_path}/${_RC_FILE}")
endif()
set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
endforeach()
+ unset(_RC_FILES)
# Since this cmake macro is doing the dependency scanning for these files,
# let's make a configured file and add it as a dependency so cmake is run
# again when dependencies need to be recomputed.