I have relatively complex cmake files and I am wondering if there is any utility that can reformat a cmakeList.txt and beautify it for easier reading?
Some simple tricks would do the jobs, such as indenting if else endif sections and so on.
Is there any such tools?
I am using notepad++ for editing, but if there is any other tools, I can switch.
I searched for a code beautifier supporting CMake, and I did not find any.
Looks like implementing CMake support in an existing beautifier, or writing a custom one is a great idea for a nice code project.
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.