Caching¶
vcpkg caches many packages under the hood and reuses them whenever possible.
It mostly is the case if a package has previously been built for a project and another project uses the exact same version of the package.
vcpkg relies on the package ABI (Application Binary Interface) to identify each package and determine if it can be reused. This can depend on many things:
package version,
port version,
target triplet,
host triplet,
and many others.
If this ABI hash is the same vcpkg will not rebuild the package and will instead use the cached one by copying results into:
The
vcpkg_installeddirectory of the new project if using vcpkg manifest mode.The local vcpkg repository if using vcpkg classic mode.
This is why the following installation sections prefer to first
install packages using the vcpkg install command before
using it via CMake later during configuration phase.
Errors are more easily spotted during the first part, and if
the first installation is successful, caching will allow to
reuse the same packages during configuration as long as the
package’s ABI is identical.
vcpkg stores its binary cache in the user’s cache directory by default:
Windows:
%LOCALAPPDATA%\vcpkg\archives(C:\Users\<user>\AppData\Local\vcpkg\archives),Linux and macOS:
~/.cache/vcpkg/archives(or$XDG_CACHE_HOME/vcpkg/archives).
The VCPKG_DEFAULT_BINARY_CACHE environment variable
moves it elsewhere.
See also
For more information: vcpkg binary caching