Skip to content

Instantly share code, notes, and snippets.

@bmegli
Created October 7, 2021 15:28
Show Gist options
  • Save bmegli/78f453f954c79ee7eedc1d374a542f9d to your computer and use it in GitHub Desktop.
Save bmegli/78f453f954c79ee7eedc1d374a542f9d to your computer and use it in GitHub Desktop.
VCPKG cheatsheat

Unninstalling Packages

# vcpkg_target_triplet is envirnoment variable with triplet name
vcpkg remove package:%vcpkg_target_triplet% --recurse

Installing Packages

# vcpkg_target_triplet is envirnoment variable with triplet name
vcpkg install package:%vcpkg_target_triplet%

Rebuilding package at commit/tag

For ports with vcpkg_from_github

  • uninstall package
  • edit the portfile (e.g. portfile.cmake, in `ports/package_name/)
    • change vcpkg_from_github REF to commit or tag
    • change SHA512 to 0
  • try to install package
    • it will complain about SHA not matching
    • and will output correct SHA
    • copy correct SHA to portfile
  • install again

The vcpkg_from_github in port file looks like that:

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO github_user_or_org/github_repo
    REF commit_or_tag
    SHA512 long_string_of_decimals
    HEAD_REF branch
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment