Run cx help <command> or cx <command> --help for the same information in the terminal.
| Option | Meaning |
|---|---|
| -q, --quiet | don't print status messages |
| -v, --verbose | print the commands cx runs, its HTTP requests, and full CMake output |
| --color <WHEN> | auto (default), always or never |
| --offline | never use the network; use cached registry data and git clones |
| -h, --help | print help |
| -V, --version | print the version (before the command name) |
These apply to build, run, test, bench, tree and generate:
| Option | Meaning |
|---|---|
| -F, --features <LIST> | features to enable, comma-separated or repeated |
| --no-default-features | don't enable the default feature |
| --all-features | enable every feature |
| -p, --package <NAME> | in a workspace: only this member |
| --workspace | in a workspace: every member, even inside a member's directory |
| --message-format <FMT> | human (default) or json: JSON lines on stdout |
cx update also takes -p and --workspace.
new creates a package in a new directory. init creates one in an existing directory (default: .) and never overwrites files.
| Option | Meaning |
|---|---|
| --lib / --bin | create a library / a binary (the default) |
| --c | create a C package instead of C++ |
| --std <N> | language standard (default: C++23 / C17) |
| --name <NAME> | package name (default: the directory name) |
| --vcs <VCS> | git (default) or none |
| --author-from <SOURCE> | where package.authors comes from: auto (default: git's author, if git knows one), git (an error if it doesn't) or none |
| --from <FILE> | init only: draft cx.toml from an existing CMakeLists.txt or vcpkg.json; repeat it to read both. See Importing an existing project |
| --dry-run | with --from: print the cx.toml instead of writing it |
Compiles the package and its dependencies.
| Option | Meaning |
|---|---|
| -r, --release | build with optimizations (the release profile) |
| --profile <NAME> | build with a profile (default: debug); output goes to target/<NAME>/ |
| --target <TRIPLE> | cross-compile with [target.<TRIPLE>] (see Toolchains); output goes to target/<TRIPLE>/<profile>/. Also on run, test, bench, lint, metadata and clean |
| -j, --jobs <N> | parallel jobs (default: build.jobs from the configuration, else the number of CPUs) |
| --locked | fail if cx.lock needs to change |
| --bins | build the binaries (they're always built) |
| --tests | also build the test programs |
| --examples | also build the examples |
| --example <NAME> | also build this example (repeatable); without NAME, lists the examples |
| --benches | also build the benchmarks |
| --all-targets | also build tests, examples and benchmarks |
Builds the package and runs one of its binaries with ARGS. Accepts --release, --profile, --jobs and --locked. The exit code is the program's.
| Option | Meaning |
|---|---|
| --bin <NAME> | the binary to run (default: the only one, or package.default-run) |
| --example <NAME> | build and run an example from examples/ instead; only that example is built |
As in Cargo, --bin or --example without a name lists the binaries or examples (and exits with an error), and so does a name that doesn't exist. With several binaries and neither --bin nor default-run, cx run fails and lists them.
Builds and runs the test programs in tests/ through ctest. ARGS go to ctest. Accepts --release, --profile, --jobs and --locked.
Builds the benchmarks in benches/ with the release profile (or --profile), then runs each one with ARGS. cx doesn't prescribe a benchmark framework: a benchmark is a program. The exit code is the first non-zero one.
| Option | Meaning |
|---|---|
| --bench <NAME> | only run this benchmark |
Formats the package's own files with clang-format. --check only lists the files that need formatting and fails if there are any. See Formatting, linting and docs.
Builds, then runs clang-tidy on every source file of the package, and fails if it reports anything. --fix applies its fixes. Takes the options of cx build.
Generates the API reference of the package and of every cx package it depends on with Doxygen, like cargo doc: target/doc/<name>/index.html for each, linked to each other, and target/doc/index.html listing them. See Formatting, linting and documentation.
| Option | Meaning |
|---|---|
| --open | open the package's page (or the index, for several) in the browser |
| --no-deps | don't document the dependencies |
| --document-private-items | also document src/ and private members |
| -F, --features, --all-features, --no-default-features | the features whose #ifdefs are documented |
| --locked | fail instead of changing cx.lock |
Adds a dependency to cx.toml and resolves. With no source option, it adds a registry dependency. Without a requirement, it writes "^<resolved version>".
| Option | Meaning |
|---|---|
| --git <URL> with --tag / --branch / --rev | git dependency |
| --path <PATH> | path dependency |
| --system with --package <NAME>, --component <NAME> | system dependency |
| --vcpkg with --package <NAME>, --component <NAME> | vcpkg dependency: the port NAME (vcpkg = true) |
| --build-system <SYSTEM> | with --git/--path: cmake, configure or scons |
| --lib <NAME> | a library a configure or SCons project builds (repeatable; libs) |
| --registry <NAME> | registry to use (default: the default registry) |
| --version <VERSION> | requirement (registry), exact provided version (plain CMake git/path), or minimum (system, vcpkg) |
| --target <TARGET> | CMake target to link (repeatable) |
| --option <KEY=VALUE> | CMake option for the dependency (repeatable) |
| --dev | add to [dev-dependencies] |
| --optional | only include it when a feature enables it |
| -F, --features <LIST> | features of the dependency to enable |
| --no-default-features | don't enable the dependency's default feature |
| --public | part of the library's interface: users get its headers too (public = true) |
| --platform <COND> | only on these platforms: add to [target.<COND>.dependencies], where COND is cfg(...) or a triple |
| --build | add to [build-dependencies]: a tool whose binaries [[generate]] runs |
Adding a dependency that already exists replaces its entry. A dependency declared in another section (say, a platform's) must be removed first.
Removes a dependency (--dev for a dev-dependency) and resolves again. A platform-specific dependency is removed from its [target.*] section.
Resolves again, ignoring the locked versions of PACKAGES (default: all of them), and writes cx.lock.
| Option | Meaning |
|---|---|
| --resolution <STRATEGY> | prefer highest (default) or lowest allowed versions |
Shows the dependency tree with versions, sources and enabled features. Accepts --locked. Packages already shown are marked (*). --target <TRIPLE> shows the platform-specific dependencies of that target instead of the host's.
Resolves, writes the generated CMake project, and prints the path of its CMakeLists.txt. Use it for IDEs.
Deletes target/. Use --release, --debug or --profile <NAME> to delete only one profile. --gc only deletes stale directories: profiles no longer in cx.toml, and --target triples not built for 90 days.
Shows or cleans up cx's cache (see Build caches).
| Option | Meaning |
|---|---|
| --max-age <AGE> | gc: remove what wasn't used for this long, e.g. 30d, 12h, 2w (default 90d) |
| --max-size <SIZE> | gc: then remove the least recently used until this much is left, e.g. 10GiB |
| --kind <KIND> | only registry, index, git, artifacts, tools or install (repeatable) |
| --dry-run | show what would be removed |
Compiles the package's sources for errors only (-fsyntax-only, MSVC /Zs), without generating code or linking. Accepts the options of cx build (--release, --profile, --target, --jobs, --locked, features, -p). --all-targets also checks tests, examples and benches. See cx check.
Resolves without building and prints the packages, their targets and the build directories as one JSON document. See Build output and JSON. Accepts --profile, --release, --locked, the feature options, -p and --workspace.
Checks cx.lock against an advisory database (--db, audit.database or CX_AUDIT_DB). Fails on vulnerabilities, and with --deny warnings on informational advisories too. See Security.
Downloads every locked registry archive again (ignoring the cache) and checks it against cx.lock and the index; checks that locked git commits and tags are unchanged. See Security.
Signs a static registry index: keygen writes a new secret key and prints its public key, sign signs every index file in DIR (or just FILE, such as a release's cx-release.toml), pubkey prints the public key of a secret key. See Security.
install builds a package (the current one, NAME[@REQ] from a registry, --git <URL> with --tag/--branch/--rev, or --path <DIR>) in release mode and installs its binaries. uninstall removes what install installed. See Installing and CMake export.
| Option | Meaning |
|---|---|
| --root <DIR> | the prefix (default: CX_INSTALL_ROOT, else ~/.local) |
| --lib | also install the library, its headers and a CMake package config |
| --registry <NAME> | the registry for NAME[@REQ] |
| --debug, --profile <NAME> | install another profile's build |
| -p <NAME> | the workspace member to install |
Copies the sources of every locked registry and git dependency into DIR (default: vendor/ next to cx.lock) and prints the [source] setting that makes builds use them. See Vendoring.
Writes target/package/<name>-<version>.tar.gz and builds the unpacked archive to check it. See Publishing.
| Option | Meaning |
|---|---|
| --list | print the files that would be packaged, and stop |
| --no-verify | don't build the unpacked archive |
Packages the package and publishes it: into a local static index, or through the registry's API.
| Option | Meaning |
|---|---|
| --registry <NAME> | registry to publish to (default: the default registry) |
| --index <DIR> | publish into this local index directory (a checkout of a static registry) |
| --dry-run | do everything except publishing |
| --no-verify | don't build the unpacked archive |
| --sign-key <FILE> | sign the changed index file (static registries) |
Marks a published version as yanked, so new resolutions skip it.
| Option | Meaning |
|---|---|
| --undo | un-yank the version |
| --registry <NAME> | registry (default: the default registry) |
| --index <DIR> | yank in this local index directory |
| --sign-key <FILE> | sign the changed index file |
Shows or changes settings in the configuration files. list shows every setting with where it came from. set and unset edit ~/.config/cx/config.toml, or with --project the project's .cx/config.toml. Keys: registries.<name>, net.offline, net.retries, build.jobs, term.color, tools.<name>, tools.mirror, and the others in Configuration.
Shows or downloads the external tools cx runs: cmake, ninja, clang-format, clang-tidy, doxygen, python, scons, vcpkg, make and autoreconf.
Updates cx itself, like uv self update. See Updating cx.
| Option | Meaning |
|---|---|
| --dry-run | update: show what would be installed, and change nothing |
login reads a token from standard input and stores it for the registry (default: the default registry) with the registry's first credential provider: by default in ~/.config/cx/credentials.toml (mode 0600). logout removes it.
A separate program, installed next to cx: a small registry server. See Running a registry.
| Option | Meaning |
|---|---|
| --url <URL> | init: write an absolute api URL (default: api, relative to the index) |
| --signing-key <FILE> | sign config.toml (init) and every changed index file (serve) |
| --listen <HOST:PORT> | where to listen (default 127.0.0.1:8080; port 0 picks a free one) |
| --tokens <FILE> | the tokens file (default <ROOT>/.cx-registry/tokens.toml) |
| --max-upload <MIB> | the largest accepted upload (default 64) |
| --name <NAME> | the new token's name |
| --scope <SCOPE> | publish or yank (repeatable; default both) |
| --package <GLOB> | only for matching packages (repeatable; default all) |