I have a project which uses exact versioning for several dependencies, and this is all specified in a vcpkg.json
manifest file in the project’s repo.
When I build the package (cmake -DCMAKE_TOOLCHAIN_FILE=<path/to/vcpkg>/scripts/buildsystems/vcpkg.cmake ..
) it appears to have no problem re-using the cached versions of all of my dependencies, which is good as some of them take quite a long time to build.
I have just recently attempted two things though, that left me somewhat confused:
- I created a custom-overlay to test installing my project (in preparation for adding it to a private vcpkg registry, before our eventual public release of the software in the coming months). The
vcpkg.json
in the custom-overlay contains the same exact versions for dependencies as my project (since they are copied directly from the project). Same baseline as well (again, thevcpkg.json
was copied directly from the project). When I attempt to then install this custom-overlay port with the same vcpkg instance however, it completely re-installs everything. - I also have a second project that uses some of the same exact dependencies. When I build this project, it also totally rebuilds dependencies that should have already been installed by the other project. (again, same baseline and versions used).
This implies to me that vcpkg is unable to re-use binary caches between distinct projects, which feels a bit ridiculous when build times can be extremely long? Is there anyway to force this behavior?
Additionally, when I look at the vcpkg/installed
and vcpkg/packages
directories, I am somewhat confused as to what the distinction is. I understand that things located in vcpkg/installed
were installed using “classic mode” (vcpkg install _
) while things in vcpkg/packages
were installed by some project’s manifest mode. But it isn’t clear to me how they are treated differently. My assumption, given the above, is that however it caches things in vcpkg/packages
, those cahces are only valid on a per-project basis, and not globally. But it isn’t clear to me how thats being enforced or why that would be desirable in the case where an exact version is to be reused.
I guess my confusion is why vcpkg would completely rebuild dependencies for different projects (even a port of a project where the dependencies are 1:1 exact), when it shouldn’t be necessary.