Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clion and CMake messages

Tags:

cmake

clion

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.

like image 896
krapht Avatar asked May 20 '15 23:05

krapht


4 Answers

Use message(WARNING ...) instead of message(...). Warnings go to stderr.

like image 81
Sergey Voronov Avatar answered Oct 23 '22 18:10

Sergey Voronov


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.

like image 27
Michael Avatar answered Oct 23 '22 19:10

Michael


Warning and errors are displayed, but other messages are currently suppressed. However, there is a feature request concerning this issue.

like image 34
MarkusParker Avatar answered Oct 23 '22 19:10

MarkusParker


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.

like image 33
CODE-REaD Avatar answered Oct 23 '22 19:10

CODE-REaD