Toolkit: The Conan Ecosystem
The tools around Conan that you'll meet in real projects, grouped by job. Most of them were introduced in earlier lessons; this page is the map to come back to.
Sources of packages
| Tool | Notes |
|---|---|
ConanCenter (conan.io/center) |
the public repository: recipes, prebuilt binaries for common configurations, a web UI with each package's options and versions |
| conan-center-index (GitHub) | the recipes behind ConanCenter; read them to learn idiomatic recipes, fork them for a local-recipes-index remote |
| Artifactory (Community Edition for C/C++ is free) | private remotes: local, remote (ConanCenter proxy) and virtual repositories (Remotes) |
| conan_server | minimal reference server (pip install "conan[server]"), for experiments and small teams; run for real in Remotes |
| local-recipes-index remote | a folder or Git repo of recipes; no binaries |
Extending Conan
Conan 2 is designed to be extended with Python files in the Conan home, which teams distribute with conan config install <git-url-or-zip>:
| Extension | Folder in ~/.conan2/extensions/ |
Use |
|---|---|---|
| custom commands | commands/cmd_<name>.py |
team workflows as conan <name> |
| deployers | deployers/<name>.py (built-ins: full_deploy, direct_deploy, runtime_deploy) |
copy packages out of the cache (for installers, Docker images) |
| plugins | plugins/ (compatibility/, profile.py, sign/) |
binary compatibility rules, profile validation, package signing |
| hooks | hooks/hook_<name>.py |
run checks before/after export, build, package (e.g. lint recipes) |
| python_requires | (a package) | share base classes and helpers between recipes |
Here's a small custom command that lists the cache in a compact, team-specific format, plus the full_deploy deployer copying a graph's packages into the project:
mkdir -p ~/.conan2/extensions/commands
cat > ~/.conan2/extensions/commands/cmd_inventory.py <<'PY'
from conan.api.model import ListPattern
from conan.api.output import cli_out_write
from conan.cli.command import conan_command
@conan_command(group="Team")
def inventory(conan_api, parser, *args):
"""List every package in the local cache with its binaries' build types."""
parser.parse_args(*args)
pkglist = conan_api.list.select(ListPattern("*/*#*:*", rrev=None))
for ref, data in sorted(pkglist.serialize().items()):
for rrev in data["revisions"].values():
pkgs = rrev.get("packages", {})
kinds = sorted(p["info"].get("settings", {}).get("build_type", "any") for p in pkgs.values())
cli_out_write(f"{ref:<16} {len(pkgs)} binary {', '.join(kinds)}")
PY
conan -h 2>&1 | grep -A1 'Team commands'
conan inventory 2>/dev/null
echo "--- full_deploy"
mkdir -p app && cd app
conan install --requires=spdlog/1.17.0 --deployer=full_deploy > /dev/null 2>&1
find full_deploy -name '*.a' | sortTeam commands
inventory List every package in the local cache with its binaries' build types.
catch2/3.16.0 1 binary Release
cmake/4.4.4 1 binary any
fmt/12.1.0 1 binary Release
spdlog/1.17.0 1 binary Release
--- full_deploy
full_deploy/host/fmt/12.1.0/Release/x86_64/lib/libfmt.a
full_deploy/host/spdlog/1.17.0/Release/x86_64/lib/libspdlog.a
The command shows up in conan -h under its own group and uses the same Python API as Conan's built-in commands. Distribute it in a Git repository of team config (profiles, global.conf, remotes, extensions) and every developer runs conan config install https://git.example.com/team/conan-config.git once.
Inspecting and debugging
| Command | Answers |
|---|---|
conan graph info . --format=html |
what's in the graph, with conflicts highlighted |
conan graph explain |
why a binary is missing, and the closest one available |
conan list "pkg/*:*" -r remote |
which binaries a server has |
conan inspect <path> |
a recipe's attributes (name, options, settings) without building |
conan cache path |
where a package lives on disk |
conan install … -vvv / --logger |
detailed logs |
conan audit scan |
known vulnerabilities in the graph's packages (needs network access and a free audit token) |
conan graph info . --format=json → SBOM tools |
inventory for license and security review; Conan also ships a CycloneDX SBOM helper |
Integrations
| Tool | Notes |
|---|---|
| CLion Conan plugin, VS Code CMake Tools | both pick up the CMakeUserPresets.json that conan install writes |
cmake-conan (conan_provider.cmake) |
CMake dependency provider: cmake -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake runs conan install automatically from find_package |
| Visual Studio / MSBuild | MSBuildDeps + MSBuildToolchain generators |
| Meson, Autotools, Bazel, premake | MesonToolchain, AutotoolsToolchain/AutotoolsDeps, BazelDeps, PkgConfigDeps generators |
JFrog CLI (jf) |
uploads with build-info, promotion between repositories, Xray scans |
| Conan Docker images | official CI images exist, but most teams build their own with pinned compilers |
JFrog CLI (sample)
The JFrog CLI wraps Conan commands to record build-info (which packages a build consumed and produced) in Artifactory, then promotes a tested build from a dev to a release repository:
jf c add company --url https://artifactory.example.com --access-token "$JF_TOKEN"
jf conan install . --build-name=wordstat --build-number=$BUILD_ID # wraps conan install
jf conan upload "wordstat/*" -r conan-dev --build-name=wordstat --build-number=$BUILD_ID
jf rt build-publish wordstat $BUILD_ID
jf rt build-promote wordstat $BUILD_ID conan-release --status=releasedCheck jf conan --help for your CLI version; the Conan integration has changed between JFrog CLI releases.
Test yourself
Where do you put a custom conan inventory command?
- In the project's conanfile.py
- ~/.conan2/extensions/commands/cmd_inventory.py
- settings.yml
- A profile
What does --deployer=full_deploy do?
- Uploads to all remotes
- Copies every package of the graph out of the cache into a local folder
- Deploys to production servers
- Builds everything
How does a team share profiles, remotes and extensions with every developer?
- conan config install <repo-or-zip>
- Copy ~/.conan2 by hand
- It can't