This creates:
cx new also runs git init, unless you pass --vcs none or the directory is already inside a git repository. Like uv init, it writes your git author (user.name and user.email) into authors; --author-from none leaves it out. Other variants:
| Command | Creates |
|---|---|
| cx new --lib mylib | a library, with include/mylib/mylib.hpp, src/mylib.cpp and a test |
| cx new --c hello | a C program |
| cx init | a package in the current directory, without overwriting existing files |
| cx init --from CMakeLists.txt | a cx.toml drafted from the project's CMake build (and --from vcpkg.json); see Importing an existing project |
cx add edits cx.toml in place, keeping your comments and formatting. It then resolves the dependencies right away. If that fails, it puts cx.toml back the way it was.
Then use the dependency:
Every file directly in tests/ becomes a test program. A test passes when it exits with status 0:
Arguments after -- go to ctest, e.g. cx test -- -R parser.
The repository's examples/ directory has small, complete projects, one feature each: a library with tests and benchmarks, a C package, a workspace, features, plain CMake and system dependencies, code generation, profiles, a shared library, platform-specific dependencies, C++20 modules, and dependencies from git, vcpkg and Autotools. Each cx.toml starts with the commands to try.