[CMake] AStyle or similar code beautifier

Rob McDonald rob.a.mcdonald at gmail.com
Fri Jan 31 11:30:00 EST 2014


Thanks to everyone for all the helpful responses.  It looks like most of
the ideas were pretty similar to what I was thinking.  Glad to know I
wasn't missing anything huge.

I had found UniversalIndentGUI and plan on using it.  I had also found
uncrustify and will take a closer look at it.


On Fri, Jan 31, 2014 at 1:55 AM, Игорь Пашев <pashev.igor at gmail.com> wrote:

> Code formatting is completely out of scope of building system.
>


I think that CMake has historically trended towards an expansionist view of
what it can/should be used for, not a restrictionist one.  I think a lot of
the other posters make good cases for why this may be a good idea.

In general, I think of CMake as a tool that helps to standardize working
with code.  That can be cross platform builds, support for build farms and
unit testing, automatic documentation generation, packaging of the project,
etc.

I want to clean up a large codebase with years of formatting neglect in an
automated way.  AStyle or Uncrustify are the right tool for this.  I would
like to give my team an easy way to check the formatting against the same
style.  Including a config file or the full command line with options is a
good tool for this.  My team works on different platforms, so a
FindAStyle.cmake which just uses Find_Program and CMake's cross platform
scripting are good solutions to make this easy.  Including format checking
or reformatting as build targets increase the probability that my team will
use these tools.  With CMake, those build targets show up for my team, no
matter whether they use Make, Visual Studio, Eclipse, etc.

If our project someday graduates to a more advanced level, then the kind of
integration that BRL-CAD uses with automatic format checks with warnings on
every build could be a good step -- and CMake would be a good tool to help
make that happen.

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140131/8aa8aee7/attachment.html>


More information about the CMake mailing list