build: fix re-downloading vcpkg binary packages

Fix re-installing binary packages on next cached run by clearing the
cache entries for `vcpkg list`. Also remove the binary packages
directory after installing.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2025-07-15 21:05:07 +00:00
parent bbaf70c083
commit 1f3a1cb9dc
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 9 additions and 0 deletions

View File

@ -267,6 +267,13 @@ function(zip_is_installed vcpkg_exe zip outvar)
set(${outvar} ${pkg_installed} PARENT_SCOPE)
endfunction()
function(cleanup_binary_packages)
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/vcpkg-binary-packages")
unset(VCPKG_INSTALLED CACHE)
unset(VCPKG_INSTALLED_COUNT CACHE)
endfunction()
function(get_binary_packages vcpkg_exe)
set(binary_packages_installed FALSE PARENT_SCOPE)
@ -396,6 +403,8 @@ function(get_binary_packages vcpkg_exe)
file(REMOVE_RECURSE ${bin_pkgs_dir})
endif()
cleanup_binary_packages()
set(binary_packages_installed TRUE PARENT_SCOPE)
endfunction()