Is there any utility that can reformat a cmake file

删除回忆录丶 提交于 2019-12-05 03:51:32

Take a look at Atom and its plugin language-cmake (you can install easily with Atom package manager).

Once both are installed, open your CMakeLists.txt and go to Edit > Lines > Auto Indent.

Someone recently wrote a CMake autoformatter called cmake_format. Still under development but should be good enough for basic CMake files.

I searched for a code beautifier supporting CMake, and I did not find any.

  • There is this thread on CMake mailing lists, which does not provide a good solution
  • This mailing list thread provides no answer too (some use emacs mode)
  • I checked most of the major code beautifiers using UniversalIndentGUI on Ubuntu. None of the provided beautifiers from the long list are working with CMake out of the box.

Looks like implementing CMake support in an existing beautifier, or writing a custom one is a great idea for a nice code project.

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