Files
cmake/.devcontainer/devcontainer.json
T
Taylor Braun-Jones d326c8afd5 devcontainer: Add a Dev Container definition for CMake development
Provide a `.devcontainer` definition, following the Dev Container
Specification, to give contributors a ready-made Linux environment with
the tools needed to build CMake, run its test suite, build its
documentation, and satisfy its style rules.

Base the container on Ubuntu, which offers the broadest ecosystem of
packages and tooling for development, including a recent `cmake` and the
`clang-format` version our style rules require, exactly.  Mirror the
package lists of the Debian image our CI infrastructure uses, section by
section, so that the dependencies available closely match the ones
against which merge requests are tested.  Build the image the way the
images under `.gitlab/ci/docker/` are built: bind mount the package
lists and the installation script rather than copying them in, and cache
the package lists and downloaded archives so that a rebuild fetches only
what has changed.

Run optional `.devcontainer/hooks/root.sh` and
`.devcontainer/hooks/user.sh` scripts, both ignored by Git, so that
developers may customize the container without modifying tracked files.

Document usage in a new `Help/dev/devcontainer.rst`.

Fixes: #28043
2026-09-08 16:23:33 +00:00

31 lines
718 B
JSON

{
"name": "CMake",
"build": {
"dockerfile": "Dockerfile"
},
"remoteUser": "cmake-dev",
"mounts": [
{
"type": "volume",
"source": "cmake-dev-ccache",
"target": "/home/cmake-dev/.cache/ccache"
}
],
"postAttachCommand": "${containerWorkspaceFolder}/.devcontainer/setup-status.sh",
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"lextudio.restructuredtext",
"llvm-vs-code-extensions.vscode-clangd"
],
"settings": {
"C_Cpp.clang_format_path": "/usr/bin/clang-format-18",
"cmake.configureOnOpen": false
}
}
}
}