I just started using the Clion IDE. Maybe this is written somewhere but I haven't seen it in a Google search. If I put a message()
call in my CMake script, where in Clion can I see the output? These message calls are the only way that I know how to debug my CMake scripts.
-
Does the IDE has a log window or something? – Joel May 20 '15 at 23:48
-
Yeah, but it's focused on the outputs of gcc, ld, etc. CMake prints to stdout, but the log window doesn't catch it. – krapht May 20 '15 at 23:56
-
Maybe you need to configure it to run cmake so you can catch the stdout, stderr, etc. – Joel May 21 '15 at 01:41
4 Answers
Use message(WARNING ...)
instead of message(...)
. Warnings go to stderr.

- 16,549
- 8
- 60
- 74

- 226
- 2
- 2
-
1
-
2Sorry to contradict you Brent but I'm using CLion 2016.2.2 and had the same problem and only the solution suggested by Sergey fixed it for me. – David Roulin Oct 12 '16 at 23:22
Another possible workaround:
- disable "cmake auto-reload" if it is enabled
- after you changed something in your cmake file, don't trigger "Reload changes"
- run/build your project
When clion starts a build, it realizes the cmake files are not up-to-date and reloads them, but like other build output it is displayed inside the Messages tab.

- 91
- 1
- 2
-
4This should be the answer. At least for CLion 1.5+, it erases the CMake output if Auto-Reload-CMake is on. – Brent Faust Feb 26 '16 at 04:18
Warning and errors are displayed, but other messages are currently suppressed. However, there is a feature request concerning this issue.

- 1,264
- 2
- 17
- 35
As of CLion 2016.2.2, Build #CL-162.1967.7, CLion is displaying CMake message(STATUS) output in its Messages tool window (Alt+0) during Build (Ctrl+F9) when a project is first built after changes to CMakeLists.txt. But as noted in the other answers, this output doesn't show in CLion's CMake tool window (as many would prefer).
Update: Above I wrote that CLion "is displaying message(STATUS) output." I now find that this occurs intermittently. @Michael wrote that this happens if you skip cmake reload after modifying your cmake file, but I've found CLion sometimes does not display any CMake output in its Messages tool window even under this condition. So far I haven't discovered the exact circumstances that make CLion show CMake message(STATUS) output, will report back here when/if I do.
Big Update: CLion opens 2016.3 EAP: user-defined literals, CMake output, C11 keywords completion and more. See in particular:CMake output window: a separate I think it fixes this whole problem: CLion 2016.3 EAP adds a new tab that contains CMake command output.
Of course, this is EAP, which comes with JetBrains' caveat:
It is important to distinguish EAP from traditional pre-release software. Please note that the quality of EAP versions may at times be way below even usual beta standards.
So use it at your own risk, but you may judge this a risk worth taking if you need the CMake debugging.

- 2,819
- 3
- 33
- 60