Skip to main content

Sphinx Domain for Modern CMake

This is taken directly from the Kitware git repository's Utilities directory. The original sphinxcontrib-cmakedomain has not been touched in quite some and as a result it was wildly out of date. Documenting CMake domain entities in projects is painful otherwise. This works exactly in the same way as Kitware, so some time might be needed to study their approach to these problems.

This repository is under the same License as all of CMake, which is the BSD-3-Clause license.

🚨🚨🚨 Any issues you run into with this plugin must be reported to Kitware, unless they involve the packaging itself. The Python files exactly match the CMake source for the released version numbers. 🚨🚨🚨

Installation

PyPI

This domain is available via PyPI. Install it directly via pip:

$ pip install sphinxcontrib-moderncmakedomain

Alternatively, place it inside of your setup.py, pyproject.toml, requirements.txt or whatever system it is that you use to declare and manage your dependencies. A new version will usually only be released if there is a change to this extension inside CMake.

Git

This module is installable via pip and GitHub directly as well

$ pip install git+https://github.com/scikit-build/moderncmakedomain.git

Usage

To enable the use of the moderncmakedomain, add sphinxcontrib.moderncmakedomain to the extensions variable of your conf.py file:

extensions = [..., 'sphinxcontrib.moderncmakedomain', ...]

The plugin currently provides several directives and references. These are documented below.

Directives

directive description
.. cmake:variable:: For a basic variable
.. cmake:command:: For a function
.. cmake-module:: Autodoc style extractor (takes a relative filepath) for markup as described in https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#a-sample-find-module
.. cmake:envvar:: For environment variables

To declare any of the references found below, they must be placed into a directory with the same name under the sphinx SOURCEDIR/master doc. Thus, prop_tgt/MY_PERSONAL_PROPERTY.rst can be referred to with :prop_tgt:`MY_PERSONAL_PROPERTY` . This is currently the only way CMake permits declaring new properties.

References

Each reference below can be placed into a directory with the same name to document custom extensions provided by your CMake libraries.

ref description
:variable: Refer to a CMake variable
:command: Refer to a CMake command
:envvar: Refers to an environment variable
:cpack_gen: Refers to CPack generators
:generator: Refers to a build file generator
:genex: Refers to a generator expression
:guide: Used to refer to a "guide" page
:manual: Used to refer to a "manual" page (like cmake(1))
:policy: Refers to CMake Policies
:module: Refers to CMake Modules
:prop_tgt: For target properties
:prop_test: For test properties
:prop_sf: For source file properties
:prop_gbl: For global properties
:prop_dir: For directory properties
:prop_inst: For installed file properties
:prop_cache: For cache properties

History

sphinx-moderncmakedomain was initially developed in October 2018 by slurps-mad-rips to help write CMake documentation by simply publishing a python package of the same. This was a critical step to ease the maintenance of sphinx-based documentation and avoid systematically copying the associated python module maintained within the CMake repository.

Later in early August 2021, henryiii discovered the sphinx-moderncmakedomain project while working on scikit-build issue #574 intended to simplify its documentation generation infrastructure and avoid updating its own copy of the sphinx extension. henryiii and jcfr then worked with slurps-mad-rips to establish a transition plan to collaboratively maintain the project within the scikit-build organization.

Metadata

Release files for sphinxcontrib-moderncmakedomain 4.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinxcontrib-moderncmakedomain 4.4.3
File Size Uploaded
sphinxcontrib_moderncmakedomain-4.4.3.tar.gz 19.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxcontrib-moderncmakedomain 4.4.3
File Interpreter ABI Platform
sphinxcontrib_moderncmakedomain-4.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 34.0 kB

Release files / sphinxcontrib_moderncmakedomain-4.4.3.tar.gz

Download URL sphinxcontrib_moderncmakedomain-4.4.3.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
23f80188bb241a4da6886f9e4b204dc62bae76060a41aa597b90f04d277410a8
BLAKE2b-256 checksum
How to use checksums
cc58b0cff6e84bf35b6c77e02a167ba683db338196efe246667510c567ac4100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / sphinxcontrib_moderncmakedomain-4.4.3-py3-none-any.whl

Download URL sphinxcontrib_moderncmakedomain-4.4.3-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7064acdcabf5548f4038a0cf2b2b34d734de863e96c673053c3aba44d3f0851e
BLAKE2b-256 checksum
How to use checksums
10a2e2794214390cc83583602c5e17699fb294ef9949481495df3fc1cf67a9e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

4.4.3 This release

2 release files

3.29.0

2 release files

3.27.0

2 release files

3.26.4

2 release files

3.25.0

2 release files

3.19

2 release files

3.17

2 release files

3.13

2 release files

3.12.1

2 release files

3.12

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page