Clion and CMake messages

北城以北 提交于 2019-12-18 19:01:58

问题


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.


回答1:


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




回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/30362176/clion-and-cmake-messages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!