Custom Registries
Overlay ports are perfect for one project. When several projects share in-house libraries, you want those ports versioned like the builtin ones: a baseline, a version history, version>= and overrides. That's a registry: a collection of ports plus a version database. The builtin registry is the vcpkg repository itself; you can add your own.
Registry kinds
| Kind | Where | Configured with |
|---|---|---|
builtin |
the vcpkg clone at $VCPKG_ROOT |
builtin-baseline or "default-registry": {"kind": "builtin", ...} |
git |
any Git repository (GitHub, GitLab, an internal server) | URL + baseline commit |
filesystem |
a folder (network share, monorepo path) | path + baseline name |
| artifact registries | for vcpkg artifacts (tools), not ports | — |
Registries are configured in vcpkg-configuration.json (or a "vcpkg-configuration" object inside vcpkg.json). Each registry claims port names with packages, which also accepts wildcards ("acme-*"), and every other port comes from the default-registry.
Layout of a registry
registry/
├── ports/
│ └── greet/ vcpkg.json + portfile.cmake (one version, or several folders)
└── versions/
├── baseline.json { "default": { "greet": { "baseline": "1.0.0", "port-version": 0 } } }
└── g-/greet.json every version: { "version": ..., "git-tree": ... } (git) or { ..., "path": ... } (filesystem)In a git registry, versions point at Git tree hashes, and vcpkg x-add-version --all computes them for you after you commit a port change. In a filesystem registry, versions point at paths ("$/ports/greet", where $ is the registry root), and the baseline is a name inside baseline.json (default "default").
A filesystem registry (runs offline)
mkdir -p registry/ports/greet/src registry/versions/g- app
cd registry
printf 'cmake_minimum_required(VERSION 3.25)\nproject(greet CXX)\nadd_library(greet greet.cpp)\ntarget_include_directories(greet PUBLIC lt;INSTALL_INTERFACE:include>)\ninstall(TARGETS greet EXPORT t)\ninstall(FILES greet.h DESTINATION include)\ninstall(EXPORT t NAMESPACE greet:: DESTINATION share/greet FILE greet-config.cmake)\n' > ports/greet/src/CMakeLists.txt
printf '#pragma once\nconst char* greeting();\n' > ports/greet/src/greet.h
printf '#include "greet.h"\nconst char* greeting() { return "hello from our registry"; }\n' > ports/greet/src/greet.cpp
cat > ports/greet/vcpkg.json <<'JSON'
{
"name": "greet",
"version": "1.0.0",
"license": "MIT",
"dependencies": [
{ "name": "vcpkg-cmake", "host": true },
{ "name": "vcpkg-cmake-config", "host": true }
]
}
JSON
cat > ports/greet/portfile.cmake <<'TXT'
vcpkg_cmake_configure(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/src")
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "MIT\n")
TXT
echo '{ "default": { "greet": { "baseline": "1.0.0", "port-version": 0 } } }' > versions/baseline.json
echo '{ "versions": [ { "version": "1.0.0", "port-version": 0, "path": "$/ports/greet" } ] }' > versions/g-/greet.json
cd ../app
echo '{ "dependencies": [ "greet", "fmt" ] }' > vcpkg.json
cat > vcpkg-configuration.json <<'JSON'
{
"default-registry": {
"kind": "builtin",
"baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471"
},
"registries": [
{ "kind": "filesystem", "path": "../registry", "packages": [ "greet" ] }
]
}
JSON
vcpkg install 2>&1 | grep -E '^ +[*]? *[a-z-]+:x64|registry|Restored|completed successfully' fmt:x64-linux@12.2.0#1
greet:x64-linux@1.0.0 -- /home/learner/app/../registry/ports/greet
* vcpkg-cmake:x64-linux@2025-08-07
* vcpkg-cmake-config:x64-linux@2026-07-21
Restored 3 package(s) from /opt/vcpkg-cache in 21.4 ms. Use --debug to see more details.
/home/learner/app/../registry/ports/greet: info: installing from filesystem registry here
All requested installations completed successfully in: 448 ms
greet was found in the filesystem registry (installing from filesystem registry here), at the version its baseline names; fmt came from the builtin registry. The manifest has no builtin-baseline this time: the baseline moved into vcpkg-configuration.json, where the default registry is declared.
A git registry (sample)
For a team, the registry is usually a Git repository. The consumer side:
{
"default-registry": {
"kind": "git",
"repository": "https://github.com/microsoft/vcpkg",
"baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471"
},
"registries": [
{
"kind": "git",
"repository": "https://git.example.com/platform/vcpkg-registry.git",
"baseline": "<commit of the registry repository>",
"packages": [ "greet", "acme-*" ]
}
]
}Publishing a new version in the registry repository:
# edit ports/greet (bump "version" or "port-version"), then:
git add ports/greet && git commit -m "greet 1.1.0"
vcpkg x-add-version greet --x-builtin-ports-root=./ports --x-builtin-registry-versions-dir=./versions
git add versions && git commit -m "greet: add version 1.1.0"
git pushConsumers then move their registry baseline to the new commit (or use version>=). Private registries need Git credentials on every developer machine and CI runner, the same as any private repository.
Registry or overlay?
| Overlay ports | Registry | |
|---|---|---|
| Versions | one (whatever is in the folder) | full history, baselines, version>=, overrides |
| Sharing | copy the folder, or a Git submodule | one URL, many projects |
| Effort | minimal | a repository and the x-add-version workflow |
| Good for | patches, one-off libraries, monorepos | in-house libraries used across teams |
Test yourself
In vcpkg-configuration.json, what does a registry's packages list do?
- Installs those packages
- Claims which port names (or patterns) come from that registry
- Lists forbidden packages
- Sets their versions
What do versions point to in a git registry vs a filesystem registry?
- URLs in both
- Git tree hashes vs folder paths
- Tags vs branches
- Nothing; only the baseline matters
When should you prefer a registry over overlay ports?
- Never
- When in-house libraries are shared across projects and need versioning
- Only on Windows
- When you have no network