Skip to main content

Dependency Commands

dcr add <name> [source]​

Adds a dependency to dcr.toml.

dcr add fmt # registry lookup
dcr add mylib ../path/to/lib # path as source
dcr add mylib path:./lib # explicit path prefix
dcr add mylib git:https://github.com/user/repo # explicit git prefix
dcr add mylib github:user/repo # GitHub shorthand
dcr add mylib gitlab:user/repo # GitLab shorthand
dcr add fmt pkg-config:fmt # system package via pkg-config
dcr add openssl pkg:openssl,libcrypto # multiple pkg-config packages

Source prefixes:

  • path: — local path
  • git: — generic git URL
  • github: — expands to https://github.com/<user>/<repo>
  • gitlab: — expands to https://gitlab.com/<user>/<repo>
  • pkg-config: / pkg: — one or more packages resolved by pkg-config
  • http:// / https:// / git@ — full URL

Flags:

  • --branch <name> — git branch
  • --tag <name> — git tag
  • --rev <hash> — git commit

If source is omitted — DCR searches connected registries. A bare relative or absolute path is accepted as a path dependency.

For pkg-config dependencies, the referenced packages must already be installed and provide .pc files. DCR invokes pkg-config during the build (using PATH and PKG_CONFIG_PATH) and forwards the returned compiler and linker flags; it does not download or build these packages.

dcr tree​

Displays the project dependency tree.

dcr tree

Example output:

my-app v0.1.0
├── fmt (registry)
│ └── spdlog (registry)
└── catch2 (registry)

For path dependencies, recursively shows their own dependencies (from their dcr.toml).