Skip to main content

cja

A CMake-compatible build system that generates Ninja build files.

Build a project with a CMakeLists.txt using:

cja
ninja

This is equivalent to the following with CMake:

cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug \
  -DCMAKE_COLOR_DIAGNOSTICS=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=1
ninja -Cbuild

Install

pip install cja

Or, if you're in a managed Python environment:

pipx install cja

Comparison to CMake

  • The build.ninja file is generated in your project root, not in the build directory. To allow multiple build configurations in parallel, the file name is <builddir>.ninja.
  • Paths are relative to the project root, while CMake uses absolute paths. This is faster, reduces output, and also reduces binary size as paths (e.g. for debug symbols) are shorter. When reading output from a Docker container, this lets you click paths and open the correct files in your local editor.
  • Instead of a separate tool like CTest, cja generates a phony test target that runs all tests as part of the Ninja build graph, so tests can start as soon as the first test binary is ready. Tests run one after another in Ninja's console pool; test-parallel (or cja test --parallel) runs them in parallel instead. Test fixtures (FIXTURES_SETUP, FIXTURES_REQUIRED, FIXTURES_CLEANUP) become dependencies between the test targets, so unlike CTest a cleanup test doesn't run when a test requiring its fixture fails.
  • Colors for compiler diagnostics are enabled by default.
  • _builddir_/compile_commands.json is always generated.
  • More colorful, simplified output. For example, when downloading dependencies, cja shows progress bars using Rich, while CMake shows no output (or simple multi-line output when -DFETCHCONTENT_QUIET=0 is specified).

Limitations to keep cja simple:

  • Only generates Ninja build files.
  • Out-of-tree builds aren't allowed.
  • Only supports Linux, macOS, and Windows.
  • Only supports clang with a GNU-like command line on Windows.

Build Subcommand

cja supports a build subcommand, which runs ninja automatically afterward.

cja --release / cja build --release

cja --release is equivalent to:

cja -Bbuild-release -DCMAKE_BUILD_TYPE=Release

cja build --release additionally runs ninja:

cja -Bbuild-release -DCMAKE_BUILD_TYPE=Release
ninja -f build-release.ninja

-B and -D

cja build, cja run and cja test accept -B and -D like cja itself, e.g. cja build -Bout -DFOO=1. -B takes precedence over build-release from --release. Passing -D reconfigures an existing build directory; without it, the existing configuration is kept.

Run Subcommand

cja also generates a run phony target that executes the first executable (or the one set via VS_STARTUP_PROJECT) in your CMakeLists.txt.

Format Subcommand

cja format formats CMake files, similar to cmake-format or clang-format:

cja format CMakeLists.txt               # print the formatted file
cja format -i CMakeLists.txt foo.cmake  # format files in place
cja format --check CMakeLists.txt       # exit with 1 if the file isn't formatted

Without file arguments it reads from stdin (use --assume-filename to tell it where the file lives).

There is no configuration file of its own. Instead, these options are read from the nearest .clang-format:

  • IndentWidth, UseTab and TabWidth
  • ColumnLimit (0 means no limit)
  • MaxEmptyLinesToKeep
  • LineEnding
  • BasedOnStyle (for the defaults of the options above) and DisableFormat

Everything else follows cmake-format's defaults, with a few differences:

  • A command call that fits on one line is kept on one line, like clang-format does (cmake-format breaks calls with more than two argument groups or six arguments).
  • Comments are never reflowed.
  • The names of user-defined commands keep their spelling (builtin commands are still lowercased) and UPPERCASE words in their arguments are treated as keywords.
  • Line endings and a UTF-8 BOM are preserved.

Use # cmake-format: off / # cmake-format: on (or # clang-format off / on) to exclude a region.

Metadata

Release files for cja 0.9.0

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

Source distribution (sdist)

Source distribution for cja 0.9.0
File Size Uploaded Provenance Actions
cja-0.9.0.tar.gz 297.6 kB With provenance Details for cja-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cja 0.9.0
File Interpreter ABI Platform Actions
cja-0.9.0-py3-none-any.whl Python 3 none any Details for cja-0.9.0-py3-none-any.whl

Total release size: 472.3 kB

Release files / cja-0.9.0.tar.gz

Download URL cja-0.9.0.tar.gz
Size 297.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8571c7e1afe07eae94a7df4ce46f5de48799fdcbf7b0053da455e1acfd93e732
BLAKE2b-256 checksum
How to use checksums
4978ae4aa048cc391ab2cf029714b2e1dfa78434e6916a30916867cefa2fc677
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 18, 2026.

Transparency log

Release files / cja-0.9.0-py3-none-any.whl

Download URL cja-0.9.0-py3-none-any.whl
Size 174.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7306339414b2dee7b160527e062507ed48996daabac8ebdd28dbffb79f0ff8bd
BLAKE2b-256 checksum
How to use checksums
3779a55ae396ee6622088a9516d459732ecd7c9db2710f15fe0933803f9609ea
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 18, 2026.

Transparency log

Security for cja 0.9.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cja-0.9.0.tar.gz

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 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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