Getting Started with cmod

A hands-on guide to creating, building, and managing C++20 projects with cmod.

Install cmod

git clone https://github.com/satishbabariya/cmod.git
cd cmod
cargo build --release
export PATH="$PWD/target/release:$PATH"

Requirements: Rust 1.70+, Clang 18+ with clang-scan-deps, Git 2.25+

Create Your First Project

cmod init hello
cd hello

This creates:

hello/
├── cmod.toml
└── src/
    └── main.cpp

Build and run:

cmod build
cmod run

Add a Dependency

cmod add github.com/fmtlib/fmt@10.0
cmod resolve
cmod build

cmod clones the repository, resolves the best matching version from Git tags, records the exact commit hash in cmod.lock, and compiles it.

The Lockfile

Check cmod.lock into version control. In CI, always use:

cmod build --locked

Dependency Graph

cmod deps --tree
cmod graph --format dot > deps.dot
cmod deps --why fmt

Run Tests

cmod test
cmod test --release

Build Profiles

cmod build              # Debug (default)
cmod build --release    # Optimized release
cmod build --jobs 8     # Parallel compilation

Set Up a Workspace

cmod init my_workspace --workspace
cd my_workspace
cmod workspace add core
cmod workspace add app
cmod build

Cache Management

cmod cache status
cmod cache clean
cmod cache gc

Verify & Audit

cmod verify
cmod audit
cmod sbom --output sbom.json

IDE Integration

cmod provides first-class editor extensions:

  • VS Code — Install the cmod extension from the Marketplace for LSP diagnostics, build commands, module graph visualization, dependency tree, and C++20 snippets.
  • CLion / IntelliJ — Install the cmod plugin from JetBrains Marketplace for LSP integration, run configurations, and tool window panels.
  • Other editors — Run cmod compile-commands to generate compile_commands.json for any LSP-compatible editor.

Common Workflows

Daily development

cmod build
cmod test
cmod run -- arg1

CI pipeline

cmod build --locked --release
cmod test --release
cmod verify
cmod sbom --output sbom.json

Updating dependencies

cmod update
cmod update --patch
cmod tidy --apply

What's Next

cmod is open source under Apache-2.0. Questions? We're on GitHub.