From bee61b0fec2bf945794e2243c05b3857ae6138a5 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 20 Jun 2017 17:19:21 +0200 Subject: [PATCH] CMake: Improve parsing of "CMake Error at" messages Handle more "CMake error at" messages. This includes the generic "Parsing failed" message from cmake. Change-Id: Ie036c606bd7a8ad9cafbc32a34a77f8b95c3defa Reviewed-by: Tim Jenssen --- src/plugins/cmakeprojectmanager/cmakeparser.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeparser.cpp b/src/plugins/cmakeprojectmanager/cmakeparser.cpp index d31ee71daf2..a06a68f6840 100644 --- a/src/plugins/cmakeprojectmanager/cmakeparser.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeparser.cpp @@ -32,7 +32,7 @@ using namespace CMakeProjectManager; using namespace ProjectExplorer; -const char COMMON_ERROR_PATTERN[] = "^CMake Error at (.*):([0-9]*) \\((.*)\\):"; +const char COMMON_ERROR_PATTERN[] = "^CMake Error at (.*):([0-9]*)( \\((.*)\\))?:"; const char NEXT_SUBERROR_PATTERN[] = "^CMake Error in (.*):"; const char LOCATION_LINE_PATTERN[] = ":(\\d+):(?:(\\d+))?$"; @@ -250,6 +250,20 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data() Utils::FileName(), -1, categoryBuild)) << QString(); + QTest::newRow("cmake error at") + << QString::fromLatin1("CMake Error at CMakeLists.txt:4:\n" + " Parse error. Expected \"(\", got newline with text \"\n" + "\n" + " \".\n") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Error, + QLatin1String("Parse error. Expected \"(\", got newline with text \" \"."), + Utils::FileName::fromUserInput(QLatin1String("CMakeLists.txt")), 4, + categoryBuild)) + << QString(); + QTest::newRow("cmake warning") << QString::fromLatin1("Syntax Warning in cmake code at\n" "/test/path/CMakeLists.txt:9:15\n"