In case it is not clear from the other answers and comments.
In Ubuntu (Debian?) there is a tool called cmake-format
, which seems to be what is called cmake_format
in other answers.
And it worked very well for me.
$ apt search cmake-format
Sorting... Done
Full Text Search... Done
cmake-format/kinetic,kinetic,now 0.6.13-2 all [installed]
source code formatter for cmake listfiles
$ cmake-format --help
usage:
cmake-format [-h]
[--dump-config {yaml,json,python} | -i | -o OUTFILE_PATH]
[-c CONFIG_FILE]
infilepath [infilepath ...]
Parse cmake listfiles and format them nicely.
...
The specification file is quite difficult to understand but I liked the default formatting anyway.
The best part is that it seems to normalize the capitalization of keywords which is what drives me crazy.