[CMake] AStyle or similar code beautifier
Matthew Woehlke
mw_triad at users.sourceforge.net
Fri Jan 31 11:12:39 EST 2014
On 2014-01-31 02:01, Rob McDonald wrote:
> I'm interested in adding a code beautifier to my project. I'm looking at
> AStyle, but am open to others.
>
> Implementing a FindAStyle.cmake is pretty trivial. Likewise, implementing
> custom targets is pretty straightforward in the simple case.
>
> However, I thought there might be some canonical/idiomatic examples of this
> sort of thing. Any pointers to projects that do this particularly well?
> Are there any other code beautifiers that already have CMake support?
By "CMake support", do you mean that can beautify CMake script? Or that
have an existing find module? (For a program like this I'm not sure I'd
bother with a find module; often, find_program is all you really need.)
As far as recommended C/C++ beautifiers, these days you might want to
look at clang-format... parsing C++ is getting harder and harder with
C++11 and later; as such it stands to reason that a tool that is backed
by a well maintained, full-blown C++ parser is likely to be beneficial.
I do use astyle for some of my own projects, but I've found that I have
to do a non-trivial amount of additional pre- and post-processing to get
good results.
--
Matthew
More information about the CMake
mailing list