[CMake] About CMakeLists.txt coding style

Edson Tadeu e.tadeu at gmail.com
Fri May 16 21:56:05 EDT 2008


Hi,

  I am looking for documentation about standard coding style, convention and
best practices on CMake programming, I couldn't find anything about it in
the Wiki or the FAQ.
  Is there some standard coding style/convention to use for CMakeLists.txt
files? Or even some "non-standard" style guide?
  I know there is the VTK Coding Standards and the ITK Coding Standards, but
they do not tell much about coding CMakeLists.txt files. All I could find
about this was a blog post (
http://people.fruitsalad.org/adridg/bobulate/index.php?/archives/458-Style-checks-for-CMake.html).

  Just looking in the documentation and in the CMake files from CMake
modules itself, from the examples, and from some other major projects (VTK,
ITK), there are all kinds of styles:

MESSAGE(HELLO)
MESSAGE( HELLO )
MESSAGE (HELLO)
message(HELLO)
message( HELLO )
message (HELLO)

  (Not even mentioning the indent style). It seems that there is a
transition going on from uppercase to lowercase in the recent CMakeLists...
I don't know what style to settle for my new CMakeLists.txt's, because if I
use lowercase, to copy&paste from other projects would be a real pain... but
maybe the projects will convert their CMakeLists to lowercase? A tool to
automatically convert from uppercase commands to lowercase would help.
  And, well, if we enter into case convention of other elements such as
variables... then it starts to get into a real mess... :)

  To begin, it would be nice if a CMake "guru" created a Wiki page about
CMake style, so that all projects can be consistent with it, and so that
some style checking/conversion tools could be made.


   Regards,
Edson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080516/64464fcc/attachment.htm>


More information about the CMake mailing list