[CMake] AStyle or similar code beautifier
Leif Walsh
leif.walsh at gmail.com
Fri Jan 31 09:16:01 EST 2014
What would be a good way to run a tool like this just before compiling? My naive solution is going to be to add a custom command to run it and touch a stamp, a target to run that custom command, and then make every single target in my project depend on that custom target. Is there a less invasive way to do this in cmake?
Sent from my iPhone
> On Jan 31, 2014, at 9:06, Marcel Loose <loose at astron.nl> wrote:
>
>> On 31/01/14 14:11, Paul Smith wrote:
>>> On Fri, 2014-01-31 at 02:26 -0800, Alan W. Irwin wrote:
>>> And to answer the OP's question, I can highly recommend uncrustify for
>>> code styling
>> I agree with Alan. We did a huge reformatting effort last year to
>> change a very large C++ codebase from a style based loosely on
>> Whitesmith to a more common style. I started with AStyle which is a
>> solid program, but it has limited customization support.
>>
>> Then I found uncrustify and was quite satisfied with it. I sent a few
>> patches for minor fixes and they were well received. The main issue
>> with uncrustify is that the documentation could be better: for some of
>> the more advanced settings it's very hard to understand exactly what
>> they control.
> That's why I like universalindentgui, a standard Ubuntu package. You can
> immediately see what changes will be made to the code when you fiddle
> with one of the many settings in uncrustify (assuming it has effect on
> the source file you're viewing).
>>
>> I had to do a bit of scripting around it since uncrustify didn't handle
>> all the whitespace conversion we wanted, but it worked great!
>>
>> 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.
>
> <loose.vcf>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list