Installing Configuration

The CMake configuration for the current Sphinx version can be easily installed using Pip:

pip install sphinx-cmake

Note

Sphinx will be installed as a dependency if necessary.

The configuration files should be located in the Python installation prefix:

<python_prefix>/share/Sphinx/cmake

Installing from source

You can also install the configuration manually from the source for more control. First, obtain a copy of the source by either downloading the zipball or cloning the public repository:

git clone git@github.com:python-cmake/sphinx-cmake.git

Then build and install the package into your current Python environment:

pip install .

Note

The project can not be installed in editable mode as package data won’t be installed.

Building documentation from source

Ensure you have installed the dependencies required for building the documentation:

pip install -r ./doc/requirements.txt

Then, build the documentation with the command:

sphinx-build ./doc ./build/doc/html

View the result in your browser at:

file:///path/to/sphinx-build/build/doc/html/index.html

Package Deployment

This package is deployed as a source on PyPi to allow dynamic adaptation of CMake scripts based on the version of Sphinx available at installation. Packaging it as a wheel would lock the Sphinx version detected during the packaging and deployment process, reducing flexibility and compatibility with future versions.

If you wish to deploy the package as a source within a custom index, it is important to include the build requirements in your environment (e.g. “hatchling” and “cmake”).

See also

Package Formats