blob: cda68bceb98d120656b290e69dfae4f2b048c6d2 [file] [log] [blame]
Coding Style & Guidelines
=========================
The following sections contain |TFACMF| coding guidelines. They are continually
evolving and should not be considered "set in stone". Feel free to question them
and provide feedback.
Rules
-----
#. CMake file names use `CamelCase`_ formating.
#. Indent with tabs and otherwise use spaces. Use 4 spaces for tab size.
#. Use LF as line end in CMake files.
#. Remove trailing whitespace.
#. When complicated functionality is needed prefer CMake scripting over
other languages.
#. Prefix local variables with `_`.
#. Use functions to prevent global name-space pollution.
#. Use `snake_case`_ for function and variable names.
#. Use the ``include_guard()`` CMake function when creating new modules, to
prevent multiple inclusion.
#. Use self contained modules, i.e. include direct dependencies of the module.
#. Use the Sphinx CMake domain for in-line documentation of CMake scripts.
For details please refer to the `CMake Documentation`_.
.. todo:: Explain CMake return values and parent scope concept in more detail.
--------------
.. _`CamelCase`: https://hu.wikipedia.org/wiki/CamelCase
.. _`snake_case`: https://en.wikipedia.org/wiki/Snake_case
.. _`CMake Documentation`: https://github.com/Kitware/CMake/blob/master/Help/dev/documentation.rst
*Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.*
SPDX-License-Identifier: BSD-3-Clause