CMake coding style in ECM?

Allen Winter winter at kde.org
Tue Sep 13 21:59:44 UTC 2011


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


Additionally, there is a tool called 'cmakelint.py' that checks for all this (see attached).
I use 'cmakelint.py' at my day job (with some extra checkers) and I like it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmakelint.py
Type: text/x-python
Size: 15848 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-buildsystem/attachments/20110913/cc93dad5/attachment-0001.py>


More information about the Kde-buildsystem mailing list