What is binary caching?
Binary caching is a feature that lets vcpkg save the compiled files of a package in a shared location and reuse them when asked to build the same package with the same configuration. We call the output produced by each package build a "binary package".
Why use binary caching?
Most ports in the vcpkg curated registry are built from source. Building from source ensures maximum compatibility by using the same environment, build tools, and configurations you use for your project in your dependencies. However, this can also result in duplicated builds when multiple projects, developers, or machines require the same dependencies.
Binary caches can be hosted in a variety of environments. The most basic form of binary caching is a directory that holds zipped archives of a package's build output. More advanced scenarios include NuGet package feeds hosted in GitHub Packages, Azure DevOps Artifacts, or other such services.
Binary caching is especially effective in scenarios where dependencies and configuration
don't change often, such as in CI (Continuous Integration) or build servers. Binary packages are
particularly susceptible to configuration changes (compiler version, compilation flags, installed
tools, or vcpkg-specific script changes) which makes sharing them between developer machines
difficult. See vcpkg export
for a different option to share built
packages.
See the binary caching reference documentation to learn about the different storage backends.
Next steps
Here are other tasks to try next:
- Change the default binary cache location
- Set up a local binary cache
- Set up a binary cache using a NuGet feed
- Set up a binary cache in your GitHub Actions workflow using GitHub Packages
- Set up a binary cache in your GitHub Actions workflow using GitHub Actions Cache
- Authenticate to private NuGet feeds