vcpkg
できること
vcpkgは、C++開発者がプログラムに必要なライブラリ(パッケージ)を管理するためのツールです。さまざまなOSや設定でこれらのライブラリをインストールして使いやすくします。
使う場面
- ✓新しいC++プロジェクトを始めて、外部ライブラリを追加したいとき。
- ✓プロジェクトで特定のバージョンのライブラリを使いたいとき。
- ✓プロジェクトを異なるシステム(例:Windows、Linux)やアーキテクチャ(例:32ビット、64ビット)向けにコンパイルするとき。
スキルのリンク
https://github.com/github/awesome-copilot/blob/main/skills/vcpkg/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“vcpkgを使って、C++プロジェクトで「fmt」ライブラリを使うにはどう設定すればよいですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
vcpkgはパッケージマネージャーのように動作します。プロジェクトに必要なライブラリを指定すると、vcpkgがそれらをダウンロードしてビルドし、プロジェクトで使えるように用意します。CMakeやVisual Studioなどのビルドツールとも連携します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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-baseline - Works 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.cmake
Adding vcpkg to an Existing Visual Studio Solution
- Create
vcpkg.jsonin the solution directory - Enable 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 automatically - For user-wide integration with a standalone vcpkg installation, run
vcpkg integrate installonce - Or 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" /> - In the project file's top-level
…
よくある質問
「クラシックモード」と「マニフェストモード」の違いは何ですか?
マニフェストモード(`vcpkg.json`ファイルを使用)は、プロジェクトごとに依存関係を管理できるため推奨されています。全員が同じバージョンを使え、環境を再現しやすくなります。クラシックモードは依存関係をグローバルに管理するため、簡単な動作確認には手軽ですが、大規模なプロジェクトでは整理しにくくなります。
特定の機能(フィーチャー)を指定してライブラリをインストールするにはどうすればよいですか?
マニフェストモードでは、`vcpkg.json`ファイルに機能を記載します。クラシックモードでは、コマンドラインで角かっこを使って指定します。例:`vcpkg install library-name[feature1,feature2]`
「トリプレット」とは何ですか?
「トリプレット」は、ライブラリをビルドする対象のアーキテクチャとOSの組み合わせを表す名前です(例:Linux向け64ビットなら`x64-linux`、Windows向け64ビットなら`x64-windows`)。
詳細
作者による元の説明
Guide for setting up vcpkg in C++ projects, managing dependency versions, and cross-compiling. Covers manifest initialization, CMake and Visual Studio integration, classic-to-manifest migration, version pinning, baselines, overrides, triplets, and cross-compilation. Use when a user is working with vcpkg project setup, installation, version management, or cross-platform builds. For specialized task
repo: github/awesome-copilot
人気
- GitHubのスター
- 40k
- ランキング
- #7470
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
acquire-codebase-knowledge
40kエージェントが、既存のコードプロジェクトを理解してドキュメント化できるよう支援します。新しく参加するメンバーのオンボーディングや、アーキテクチャの全体像の把握に役立ちます。
acreadiness-assess
40kエージェントが、プロジェクトのAI対応状況を評価してレポートを生成できるよう支援します。プロジェクトがAIツールをどの程度活用できる状態にあるかを把握するのに役立ちます。
acreadiness-generate-instructions
40kエージェントが、評価結果をもとにAIツール向けの指示文を作成できるよう支援します。AIがコードとどのようにやり取りするかを改善し、特定された不足点を解消するのに役立ちます。
acreadiness-policy
40kエージェントが、AIプロジェクトの評価ポリシーの策定や適用を支援できるようにします。プロジェクトの評価方法を標準化し、コンプライアンスを確保するのに役立ちます。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。