CMake coding style in ECM?

Stephen Kelly steveire at gmail.com
Thu Sep 15 00:19:46 UTC 2011


Alexander Neundorf wrote:

> On Tuesday, September 13, 2011 11:59:44 PM Allen Winter wrote:
>> On Tuesday 13 September 2011 2:32:31 PM Stephen Kelly wrote:
>> > Hi,
>> > 
>> > I propose using a modern CMake coding style in modules added to ECM.
>> > Notable changes compared to the only existing module in there not
>> > written from scratch (ECMOptionalAddSubdirectory):
>> > 
>> > * Use lowercase CMake commands
>> > ** if(...) instead of IF(...)
>> > ** add_subdirectory instead of ADD_SUBDIRECTORY(...)
>> > ** etc
>> > 
>> > * Use empty closing macros
>> > ** endif() instead of endif(...)
>> > ** endforeach instead of endforeach(...)
>> > 
>> > What do you think?
>> 
>> We already have a CMake coding style policy
>> http://techbase.kde.org/Policies/CMake_Coding_Style
>> 
>> But I think your suggestions should be added to that policy, namely:
>> - use lowercase for the CMake commands
>> - use empty closing macros
>> as well as
>>  - 2 char indentation
> 
> Agree, except that I think 3 char indentation is used in most files, at
> least in FindKDE4Internal.cmake and KDE4Macros.cmake.
> So, if we really want to recommend how many characters to indent, I'm for
> 3. (we already recommend to used space-indentation instead of tabs).
> 

I had a look in ecm/attic, and lots of them use four or two spaces.

As the cmake style is 2 spaces, I'm for 2, but I really don't think spaces 
is a big deal. I'm happy enough to go with 

 - use lowercase for the CMake commands
 - use empty closing macros

anything else I don't feel strongly about, but will follow.

Thanks,

Steve.





More information about the Kde-buildsystem mailing list