[CMake] AStyle or similar code beautifier

Paul Smith paul at mad-scientist.net
Fri Jan 31 14:43:19 EST 2014


On Fri, 2014-01-31 at 14:24 +0100, Eric Noulard wrote:
> > We didn't try to integrate it with the build system.  We just checked in
> > the configuration file and a script people could use if they wanted to
> > re-beautify their code.
> 
> Would you mind sharing the script you used with us?

Sure, it's pretty simple.  Works on Linux and Mac.  Windows users have
to fend for themselves :-).

In addition to standard uncrustify, this converts all TABs to the
appropriate number of spaces (uncrustify doesn't mess with stuff inside
comments for example) and it removes all trialing whitespace.

This doesn't make any backup files; it's assumed you're using a source
control system and you've committed a copy beforehand (because it was
written for a one-time reformat originally) but if you want to keep
the .orig file for safety, just don't delete it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: reformat.sh
Type: application/x-shellscript
Size: 1000 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140131/fbdb2872/attachment.bin>


More information about the CMake mailing list