From a1d491ca2721d234eb10553a9e336f51752aa2a0 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 18 Jan 2018 11:45:54 +0100 Subject: Autogen: AUTOMOC/UIC fix for moc/uic include on the first line When moc/uic include was found on the first line of a file it was ignored. This fixes the issue by extending the regular expression for include detection. Closes #17655 --- Source/cmQtAutoGeneratorMocUic.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 4b02e0b..037279a 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -221,7 +221,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, const char* contentChars = meta.Content.c_str(); cmsys::RegularExpressionMatch match; while (wrk.Moc().RegExpInclude.find(contentChars, match)) { - std::string incString = match.match(1); + std::string incString = match.match(2); std::string incDir(SubDirPrefix(incString)); std::string incBase = cmSystemTools::GetFilenameWithoutLastExtension(incString); @@ -500,7 +500,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(WorkerT& wrk, const char* contentChars = meta.Content.c_str(); cmsys::RegularExpressionMatch match; while (wrk.Uic().RegExpInclude.find(contentChars, match)) { - if (!ParseUicInclude(wrk, meta, match.match(1))) { + if (!ParseUicInclude(wrk, meta, match.match(2))) { success = false; break; } @@ -1124,9 +1124,9 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() { // Precompile regular expressions Moc_.RegExpInclude.compile( - "[\n][ \t]*#[ \t]*include[ \t]+" + "(^|\n)[ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]"); - Uic_.RegExpInclude.compile("[\n][ \t]*#[ \t]*include[ \t]+" + Uic_.RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); // Initialize libuv asynchronous iteration request -- cgit v0.12