aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2021-04-17 11:02:00 +0200
committerFriedrich W. H. Kossebau <kossebau@kde.org>2021-04-23 17:49:14 +0000
commit5512e03562694ebfe571a3b6068a7d35d9ddfd7a (patch)
tree3caca041d3526c8427ec3065642b41a52ad8578c /docs
parent38b5d046c4d42232d45bf4464167b2e6feea4cf7 (diff)
downloadextra-cmake-modules-5512e03562694ebfe571a3b6068a7d35d9ddfd7a.tar.gz
extra-cmake-modules-5512e03562694ebfe571a3b6068a7d35d9ddfd7a.tar.bz2
Modules docs: move rst docs into bracket comments
CMake >= 3.0 supports bracket comments, and the reStructuredText integration code in sphinx/ext/ecm.py already supports extracting the docs from a bracket comment instead. Editing documentation without leading line comment markers is more simple, e,g. when reflowing text over lines. With ECM meanwhile requiring CMake 3.5 now it is possible to switch (and thus follow also the approach used by cmake itself). NO_CHANGELOG
Diffstat (limited to 'docs')
-rw-r--r--docs/manual/ecm-developer.7.rst107
1 files changed, 51 insertions, 56 deletions
diff --git a/docs/manual/ecm-developer.7.rst b/docs/manual/ecm-developer.7.rst
index 8054306f..b12cc83d 100644
--- a/docs/manual/ecm-developer.7.rst
+++ b/docs/manual/ecm-developer.7.rst
@@ -17,33 +17,25 @@ devoted to find modules. This guide will only highlight things that are
particular to the Extra CMake Modules project.
Most of these are stylistic points. For example, the license header for a module
-in ECM should look like::
+in ECM should look like:
- #=============================================================================
- # Copyright 20XX Your Name <your.email@example.com>
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions
- # are met:
- #
- # 1. Redistributions of source code must retain the copyright
- # notice, this list of conditions and the following disclaimer.
- # 2. Redistributions in binary form must reproduce the copyright
- # notice, this list of conditions and the following disclaimer in the
- # documentation and/or other materials provided with the distribution.
- # 3. The name of the author may not be used to endorse or promote products
- # derived from this software without specific prior written permission.
+.. code-block:: cmake
+
+ # SPDX-FileCopyrightText: 20XX Your Name <your.email@example.com>
#
- # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ # SPDX-License-Identifier: BSD-3-Clause
+
+Documentation is written in reStructuredText format and put inside a bracket
+comment with a ``.rst:`` id after the opening bracket:
+
+.. code-block:: cmake
+
+ #[=======================================================================[.rst:
+ The docs
+ #]=======================================================================]
+
+(docs/sphinx/ext/ecm.py has code to extract the rst text from a comment with
+such wrapping)
Functions should be used instead of macros unless there is a good reason not to
(and that reason should be noted in a comment), and lowercase should be used for
@@ -60,38 +52,41 @@ follow the same pattern.
Find Modules
------------
-A good template for find module documentation is::
+A good template for find module documentation is:
- #.rst:
- # FindFoo
- # -------
- #
- # Finds the Foo library.
- #
- # This will define the following variables:
- #
- # ``Foo_FOUND``
- # True if (the requested version of) Foo is available
- # ``Foo_VERSION``
- # The version of Foo, if it is found
- # ``Foo_LIBRARIES``
- # This can be passed to target_link_libraries() instead of the ``Foo::Foo``
- # target
- # ``Foo_INCLUDE_DIRS``
- # This should be passed to target_include_directories() if the target is not
- # used for linking
- # ``Foo_DEFINITIONS``
- # This should be passed to target_compile_options() if the target is not
- # used for linking
- #
- # If ``Foo_FOUND`` is TRUE, it will also define the following imported target:
- #
- # ``Foo::Foo``
- # The Foo library
- #
- # In general we recommend using the imported target, as it is easier to use.
- # Bear in mind, however, that if the target is in the link interface of an
- # exported library, it must be made available by the package config file.
+.. code-block:: cmake
+
+ #[=======================================================================[.rst:
+ FindFoo
+ -------
+
+ Finds the Foo library.
+
+ This will define the following variables:
+
+ ``Foo_FOUND``
+ True if (the requested version of) Foo is available
+ ``Foo_VERSION``
+ The version of Foo, if it is found
+ ``Foo_LIBRARIES``
+ This can be passed to target_link_libraries() instead of the ``Foo::Foo``
+ target
+ ``Foo_INCLUDE_DIRS``
+ This should be passed to target_include_directories() if the target is not
+ used for linking
+ ``Foo_DEFINITIONS``
+ This should be passed to target_compile_options() if the target is not
+ used for linking
+
+ If ``Foo_FOUND`` is TRUE, it will also define the following imported target:
+
+ ``Foo::Foo``
+ The Foo library
+
+ In general we recommend using the imported target, as it is easier to use.
+ Bear in mind, however, that if the target is in the link interface of an
+ exported library, it must be made available by the package config file.
+ #]=======================================================================]
Note the use of definition lists for the variables.