Hi Folks,

As discussed previously on the developer list:

 Code style auto-formatting
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14969
 
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14969/focus=15001
 
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14969/focus=16307
 
http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14969/focus=16358

we've decided to change the C++ coding style within CMake to use a
more modern style that can be automatically formatted.  We chose a
style defined by clang-format:

 ---
 # This configuration requires clang-format 3.8 or higher.
 BasedOnStyle: Mozilla
 AlignOperands: false
 AlwaysBreakAfterReturnType: None
 AlwaysBreakAfterDefinitionReturnType: None
 ColumnLimit: 79
 Standard: Cpp03
 ...

A simple example of the layout is:

 bool foo(int a, int b)
 {
   if (a < b) {
     return true;
   } else {
     return false;
   }
 }

This style is much more common than our old Whitesmiths-like style and
will be easier to maintain in many editors.  Also the clang-format tool
can be used to maintain the format.

The transition will be implemented as a one-shot automated style conversion
recorded as a commit by "Kitware Robot".  The use of this author will call
out the transition in `git blame` output that reaches it.  I plan to perform
the final conversion sometime before the 3.6 release freeze so that fixes
for the release do not have to be backported to the old style.

For those of you with open topics it should be possible to rebase them
across the style transition automatically.  I will include an empty commit
preceding the transition to aid with this.  Its commit message will explain
what to do.  I can help with the process for anyone that has trouble.

For reference, I've temporarily published an example topic performing the
transition here:

 https://github.com/bradking/CMake/tree/clang-format-test

-Brad
-- 

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://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to