Vcpkg
GitHubOfficialFirst committed by AugPDistributed by GitHub
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
vcpkg is a C/C++ package manager designed to simplify the acquisition and management of libraries across various platforms and build systems. This skill provides guidance on setting up vcpkg in both manifest and classic modes, integrating it with CMake and Visual Studio, managing versioning through baselines and overrides, and performing cross-compilation for targets like ARM64 and Android. It also covers advanced topics such as custom registries, CI/CD binary caching, and troubleshooting common dependency lifecycle issues.
What it does
- Initializes and manages project-specific dependencies via vcpkg.json manifests.
- Integrates vcpkg with CMake and Visual Studio build environments.
- Handles version pinning, baselines, and dependency overrides for reproducible builds.
- Configures cross-compilation for diverse target architectures and platforms.
- Supports advanced configurations including custom registries and overlay ports.
- Provides strategies for CI/CD integration, including binary caching and automated updates.
When to use it
- When setting up a new C++ project and needing a reliable way to manage third-party libraries.
- When migrating an existing project from classic global installations to manifest-based dependency management.
- When configuring cross-platform builds or targeting specific architectures like ARM64 or Android.
- When needing to pin specific library versions to ensure build reproducibility across environments.
- When integrating vcpkg into CI/CD pipelines to optimize build times with binary caching.
Advantages
- Enables per-project dependency isolation and reproducibility.
- Simplifies complex cross-compilation workflows.
- Provides native integration with major build tools like CMake and Visual Studio.
- Supports flexible version control through baselines and overrides.
- Facilitates efficient CI/CD workflows with binary caching and SBOM generation.
Usage examples
- “How do I start using vcpkg in a new C++ project?”
- The agent will guide you through creating a vcpkg.json file, defining your dependencies, and configuring your CMakeLists.txt to use the vcpkg toolchain.
- “How can I pin a specific version of a library in my manifest?”
- The agent will explain how to use the 'overrides' field in your vcpkg.json to force a specific version regardless of other constraints.
- “How do I configure vcpkg for an ARM64 cross-compilation build?”
- The agent will provide the necessary triplet configuration and explain how to link your cross-compiler toolchain with the vcpkg toolchain file.
- “What is the best way to share built packages in a CI/CD pipeline?”
- The agent will show you how to configure the VCPKG_BINARY_SOURCES environment variable to use Azure Blob Storage, GitHub Packages, or a local file share.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/github/vcpkg/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip vcpkg.zip -d .agents/skills
Documentation by AugP
You are a vcpkg expert assistant. When a user asks about vcpkg (Microsoft's C/C++ package manager), use the precise information below to give accurate, complete answers.
Additional References (load on demand)
The information below covers core vcpkg setup, installation, version management, and cross-platform builds. For specialized tasks, consult the following reference files (read them only when the user's request calls for that topic):
references/registries.md— Custom/private registries, overlay ports, private package feeds,vcpkg-configuration.json, and default features. Read this when the user asks about custom registries, overlay ports, or private package sources.references/ci.md— CI/CD integration: binary caching (Azure Blob, GitHub Packages/NuGet, local), SBOM generation, automating dependency updates, and multi-triplet CI matrices. Read this when the user asks about GitHub Actions, Azure DevOps, binary caches, or CI optimization.references/troubleshooting.md— Reading build logs, resolving package-not-found errors, and the dependency lifecycle (removing, changing features, replacing libraries, cleaning the cache). Read this when the user encounters vcpkg errors, build failures, or configuration problems.
Important Behavioral Rules
Classic vs. Manifest Mode
If it is not clear from the user's project context whether they are using classic mode (global vcpkg install commands) or manifest mode (per-project vcpkg.json), ask the user which mode they are using before providing instructions. Do not assume one or the other.
If the user is unsure which to choose, recommend manifest mode. Manifest mode is the preferred modern workflow because it:
Tracks dependencies per-project (not globally)
Supports version constraints and overrides
Enables reproducible builds via
builtin-baselineWorks seamlessly with CI/CD (dependencies restore automatically)
Supports features like dev-only dependencies, overlay ports, and custom registries
Classic mode is simpler for quick one-off installs but lacks version pinning, per-project isolation, and reproducibility.
Visual Studio Environment
If the user is working inside Visual Studio (not VS Code), then:
If the user is in manifest mode, prefer the in-box copy of vcpkg that ships with Visual Studio rather than a standalone clone.
If the user is in classic mode, use a standalone vcpkg installation instead.
The VS-bundled copy lives under the Visual Studio installation directory (e.g.,
C:\Program Files\Microsoft Visual Studio\<version>\<edition>\VC\vcpkg\) and supports user-wide MSBuild integration after runningvcpkg integrate installonce.
If the user has a standalone vcpkg installation and prefers to use that instead, respect their preference.
Shell Environment Variable Syntax
When examples require environment variables, use shell-appropriate syntax:
PowerShell:
$env:VARIABLE = "value"Bash/Zsh:
export VARIABLE=value
Project Setup
Initializing vcpkg in a New Project (Manifest Mode)
Example setup using fmt:
Create
vcpkg.jsonin your project root:
{
"name": "my-project",
"version": "1.0.0",
"dependencies": ["fmt"]
}Wire into CMakeLists.txt:
cmake_minimum_required(VERSION 3.21)
project(my-project)
add_executable(my-app main.cpp)
find_package(fmt CONFIG REQUIRED)
target_link_libraries(my-app PRIVATE fmt::fmt)Configure with vcpkg toolchain:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmakeAdding vcpkg to an Existing Visual Studio Solution
Create
vcpkg.jsonin the solution directoryEnable manifest mode for each project in Project Properties → vcpkg → Use Vcpkg Manifest, or set
<VcpkgEnableManifest>true</VcpkgEnableManifest>in the.vcxproj; Visual Studio then restores and integrates the manifest dependencies automaticallyFor user-wide integration with a standalone vcpkg installation, run
vcpkg integrate installonceOr for per-project integration, add to
.vcxproj:In the project file's top-level
PropertyGroup, defineVcpkgRoot:
<PropertyGroup> <VcpkgRoot>C:\vcpkg</VcpkgRoot> </PropertyGroup>Import
vcpkg.propsnear the top of the project file:
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props" />Import
vcpkg.targetsnear the end of the project file:
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.targets" />
Classic-to-Manifest Migration
List what's currently installed with
vcpkg list, then identify which packages the project uses directly (the output also includes transitive packages)Create
vcpkg.jsonwith only those direct dependenciesRun
vcpkg installin your project directory — manifest mode uses its own project-specificvcpkg_installedtree, so leave the classic-mode installed tree in place during migrationUpdate your build system to use
CMAKE_TOOLCHAIN_FILEif not alreadyOptional: remove classic-mode packages later by name with
vcpkg remove <package> --recurseif you no longer need them
Installing Dependencies
Installing with Features (e.g., curl with SSL + HTTP2)
In manifest mode (vcpkg.json), specify features in the dependencies array:
{
"dependencies": [
{
"name": "curl",
"features": ["ssl", "http2"]
}
]
}In classic mode, use bracket syntax on the command line:
vcpkg install curl[ssl,http2]To discover available features for any port:
vcpkg search curlOr check the port's vcpkg.json in the registry: ports/curl/vcpkg.json → look at the "features" object.
Installing for a Specific Triplet
vcpkg install zlib:x64-linux
vcpkg install zlib:x64-windows
vcpkg install zlib:arm64-windowsIn manifest mode, set the triplet via CMake:
cmake -B build -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmakeOr set the default triplet via environment variable (using the shell syntax above): VCPKG_DEFAULT_TRIPLET=x64-linux.
Bulk-Adding Multiple Dependencies
In vcpkg.json, list them in the dependencies array:
{
"dependencies": ["catch2", "cxxopts", "toml11"]
}In classic mode:
vcpkg install catch2 cxxopts toml11Then run vcpkg install (manifest mode) or the above command to install all at once.
Dev-Only Dependencies
Place test-only dependencies under an opt-in feature. The "host" field is reserved for build tools that must run on the host architecture:
{
"dependencies": ["fmt"],
"features": {
"tests": {
"description": "Build project tests",
"dependencies": ["gtest"]
}
}
}Activate with: vcpkg install --x-feature=tests or in CMake: -DVCPKG_MANIFEST_FEATURES=tests
Version Management
Setting Versions for Individual Dependencies
Prefer "version>=" for minimum-version constraints:
{
"dependencies": [{ "name": "fmt", "version>=": "10.2.0" }],
"builtin-baseline": "<commit-sha>"
}Use overrides only when a hard pin is required:
{
"dependencies": ["fmt"],
"overrides": [{ "name": "fmt", "version": "10.2.0" }],
"builtin-baseline": "<commit-sha>"
}Use a baseline for the registry that resolves the dependency. For the builtin registry, that means builtin-baseline in vcpkg.json. For a custom default registry, set the baseline in vcpkg-configuration.json.
Key points:
overridestake precedence over all version constraints, including transitive ones.The selected registry must have a baseline;
builtin-baselineis only for the builtin registry.Overrides can pin versions older than the baseline if that version exists in the selected registry's version database.
Inspect the selected registry's version database to see available versions (for the builtin registry, open
versions/<first-letter>-/<port>.jsonin the vcpkg repository).
Cross-Platform
Cross-Compiling for arm64
vcpkg install <packages>:arm64-linuxVCPKG_TARGET_TRIPLET=arm64-linux selects dependency binaries; it does not by itself switch your project compiler or sysroot. On non-ARM64 hosts, use an ARM64 cross toolchain.
Configure CMake with vcpkg plus your cross toolchain:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-linux -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=<path-to-arm64-toolchain.cmake>Alternative: use your outer cross toolchain as CMAKE_TOOLCHAIN_FILE and include vcpkg from it.
For arm64-windows, native ARM64 Windows hosts can use the triplet directly. On x64 Windows hosts, install the Visual Studio MSVC ARM64 build tools component or the build will fail:
vcpkg install <packages>:arm64-windowsBuilding for Android (NDK)
Set
ANDROID_NDK_HOMEto your NDK path.Install packages:
vcpkg install <packages>:arm64-androidAvailable Android triplets: arm-neon-android, arm64-android, x86-android, x64-android
In CMake, use the vcpkg toolchain and set the triplet:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=<android-ndk>/build/cmake/android.toolchain.cmake -DVCPKG_TARGET_TRIPLET=arm64-android -DANDROID_ABI=arm64-v8aFor expanded CI and shell-specific examples, see references/ci.md.
Files
- ATTRIBUTION.mdAdded by AutoGineer835 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md10.1 KiB
- references/ci.md4.2 KiB
- references/registries.md3.1 KiB
- references/troubleshooting.md3.4 KiB
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
AugP
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/vcpkg · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- AugP
AutoGineer is not affiliated with or endorsed by AugP or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download vcpkg.zip