[cmake-developers] Review request: extract-cmMessenger branch

Tobias Hunger Tobias.Hunger at qt.io
Thu Jun 9 05:06:54 EDT 2016


On Do, 2016-06-09 at 10:18 +0200, Stephen Kelly wrote:
> > What I would like to have, is separate subclasses for gcc-style and
> > msvc-style messages. In gcc-style, messages look like this:
> > 
> > <file_name>:row:column: error: <text>
> > 
> > In msvc-style, messages look like this:
> > 
> > <file_name>(row,column): error: <text>
> > 
> > This would make it easier to jump to the location in IDEs (and
> > powerful editors).

I would really prefer cmake to decide on one format and to stick with that
*consistently* for all messages.

Preferably with some prefix so that the IDE can actually find out that the
message is from cmake if they get dumped to stdout/stderr. Such a prefix is of
course not important when messages are reported via an API of some kind.

> Hmm, some existing clients (KDevelop) parse messages in the form they
> are already in. They would break if all message formats were changed
> substantially. Having the above behavior be dependent on some command
> line option or environment variable wouldn't be great either.

Forcing messages into one consistent format will be a pain, agreed, but
continuing to add messages in whatever form the developer likes at the time of
writing the code is even worse. CMake has a lot of different error message
styles!

Here are some of the different styles used to report various issues in cmake:

CMake Error: Error in cmake code at
/test/path/CMakeLists.txt:9:
Parse error.  Expected "(", got newline with text "


CMake Error at src/1/app/CMakeLists.txt:70 (add_custom_target):
  Cannot find source file:

    unknownFile.qml

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp


CMake Error at src/1/CMakeLists.txt:8 (add_subdirectory):
  add_subdirectory given source "app1" which is not an existing directory.


CMake Error: Error required internal CMake variable not set, cmake may be not be
built correctly.
Missing variable is:
CMAKE_MAKE_PROGRAM


Syntax Warning in cmake code at
/test/path/CMakeLists.txt:9:15
Argument not separated from preceding token by whitespace.



Multi line messages are especially hard to parse correctly with the inconsistent
reporting currently done by cmake.

> The impact of this would need to be assessed.

Almost anything will be an improvement over the status quo!

If you were to unify on e.g.

CMake Error at FILE:LINE (OPTIONAL_EXTRA_INFO):
  MULTILINE_MESSAGE_WITH_INDENT_ENDING_IN_TWO_NEWLINES

then you will probably hit existing code paths in IDEs.

Best Regards,
Tobias

-- 
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der
Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B


More information about the cmake-developers mailing list