본문으로 건너뛰기
Skillpedia
일반 코딩40k · #7470

vcpkg

하는 일

vcpkg는 C++ 개발자가 프로그램에 필요한 라이브러리(패키지)를 관리하도록 돕는 도구입니다. 다양한 운영체제와 설정에서 이 라이브러리를 쉽게 설치하고 사용하도록 합니다.

사용하는 경우

  • ✓새 C++ 프로젝트를 시작하면서 외부 라이브러리를 추가해야 할 때.
  • ✓프로젝트가 특정 라이브러리 버전을 사용하도록 보장하고 싶을 때.
  • ✓다른 시스템(예: Windows, Linux)이나 구조(예: 32비트, 64비트)용으로 프로젝트를 컴파일할 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/vcpkg/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/vcpkg/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“vcpkg로 제 C++ 프로젝트가 'fmt' 라이브러리를 사용하도록 설정하려면 어떻게 하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

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 running vcpkg integrate install once.

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:

  1. Create vcpkg.json in your project root:
{
  "name": "my-project",
  "version": "1.0.0",
  "dependencies": ["fmt"]
}
  1. 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)
  1. Configure with vcpkg toolchain:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake

Adding vcpkg to an Existing Visual Studio Solution

  1. Create vcpkg.json in the solution directory
  2. 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
  3. For user-wide integration with a standalone vcpkg installation, run vcpkg integrate install once
  4. Or for per-project integration, add to .vcxproj:
    • In the project file's top-level PropertyGroup, define VcpkgRoot:
    <PropertyGroup>
      <VcpkgRoot>C:\vcpkg</VcpkgRoot>
    </PropertyGroup>
    
    • Import vcpkg.props near the top of the project file:
    <Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props" />
    

…

자주 묻는 질문

'클래식 모드'와 '매니페스트 모드'의 차이는 무엇인가요?

매니페스트 모드(`vcpkg.json` 파일 사용)는 프로젝트별로 의존성을 관리하므로 권장됩니다. 모두가 같은 버전을 사용하게 하고 환경을 재현 가능하게 합니다. 클래식 모드는 의존성을 전역으로 관리하므로 빠른 테스트에는 간단하지만, 큰 프로젝트에는 덜 체계적입니다.

특정 기능이 있는 라이브러리는 어떻게 설치하나요?

매니페스트 모드에서는 `vcpkg.json` 파일에 기능을 나열합니다. 클래식 모드에서는 `vcpkg install library-name[feature1,feature2]`처럼 대괄호를 사용해 명령줄에서 지정합니다.

'트리플릿(triplet)'이란 무엇인가요?

라이브러리를 빌드할 아키텍처와 운영체제의 조합을 나타내는 이름입니다. 예를 들어 `x64-linux`는 Linux용 64비트, `x64-windows`는 Windows용 64비트입니다.

상세 정보

작성자의 원본 설명

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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬