Guide · Open source
How to use vcpkg: install, add packages and integrate with CMake
Updated · written with AI from the project's own documentation and checked against our catalogue data
vcpkg is a free, open-source C and C++ package manager maintained by Microsoft and the C++ community. It fetches libraries from a large registry, builds them, and makes them available to your project's build system. This guide walks through getting vcpkg from its repository, adding a library, and connecting it to CMake or MSBuild.
Quick start
- 1Clone the repository. Run git clone https://github.com/microsoft/vcpkg to get vcpkg.
- 2Read a quick start guide. Pick the guide for CMake, MSBuild, or another build system from the official docs.
- 3Create a manifest. Run vcpkg new --application in your project to create a manifest for its dependencies.
- 4Add a library. Run vcpkg add port fmt to add the fmt library to the manifest.
- 5Install packages. Run vcpkg install fmt to install packages from the command line if you are not using a manifest.
- 6Integrate with your build. Use the CMake, MSBuild, or manual integration to make the installed libraries available to your project.
What vcpkg is and who it is for
vcpkg is a C/C++ package manager that runs on Windows, macOS, and Linux. It is written in C++ with scripts in CMake, and it works with any build and project system.
It suits C and C++ developers who need third-party libraries, teams using Visual Studio, CMake, or MSBuild, and projects that want pinned dependency versions or shared built binaries. It is not meant for languages other than C/C++.
Install vcpkg by cloning the repository
The source README gives the install method as cloning the repository. Run the following command to get a copy of vcpkg:
- The README lists no separate prerequisites for this step.
- After cloning, follow one of the quick start guides linked from the official docs for your build system.
git clone https://github.com/microsoft/vcpkgAdd libraries with a manifest or the command line
For project dependencies, the README recommends creating a manifest. The example creates an application manifest and adds the fmt library as a port.
If you prefer not to use a manifest, you can install packages directly from the command line. The README example installs fmt this way.
- Manifest mode: use vcpkg new and vcpkg add port to record dependencies in your project.
- Classic mode: use vcpkg install to install packages directly.
vcpkg new --application
vcpkg add port fmt
vcpkg install fmtConnect vcpkg to CMake, MSBuild, or your editor
After installing packages, use one of vcpkg's integrations. The README lists CMake, MSBuild, and other build systems. It also links guides for Visual Studio, Visual Studio Code, CLion, and Qt Creator.
If a library you need is not in the registry, you can open an issue on the GitHub repository or contribute the package yourself.
- CMake: see the build system integration page in the official docs.
- MSBuild: follow the MSBuild quick start.
- Other build systems: use the manual integration guide.
Find commands and enable tab completion
Run vcpkg help for a short description of all available commands. Run vcpkg help [topic] for details on a specific topic.
Once vcpkg is working, the README suggests adding tab completion to your terminal.
vcpkg help
vcpkg help [topic]Key features to know about
vcpkg offers control over dependency versions, the ability to package and publish your own packages, reuse of binary artifacts, and asset caching for offline scenarios.
- Easy build system integration
- Version control of dependencies
- Publishing your own packages
- Binary caching to reuse built artifacts
- Asset caching for offline scenarios
What people use it for
- Adding the fmt formatting library to a C++ application
- Pinning dependency versions for a team using CMake or MSBuild
- Sharing built binaries across machines with binary caching
- Setting up dependencies in Visual Studio or Visual Studio Code
Frequently asked questions
Is vcpkg free?
Yes. The README describes vcpkg as a free and open-source C/C++ package manager. The code in its repository is licensed under the MIT License, and libraries from ports keep the licences of their original authors.
What operating systems does vcpkg run on?
The README says vcpkg is used by developers on Windows, macOS, and Linux. It works with CMake, MSBuild, and other build systems.
How do I install vcpkg?
The README's install method is to clone the repository with git clone https://github.com/microsoft/vcpkg. The README lists no separate prerequisites, and it points to the official quick start guides for next steps.
Can I use vcpkg offline or in an air-gapped environment?
Not directly. Most ports download source code and build tools from official locations during install. The README suggests installing once in a connected environment and populating an asset cache shared with the air-gapped machine.
How do I turn off vcpkg telemetry?
The README lists three options: run the bootstrap-vcpkg script with -disableMetrics, pass --disable-metrics on the command line, or set the VCPKG_DISABLE_METRICS environment variable.
What are alternatives to vcpkg?
The source names Conan, Hunter, and CPM.cmake as comparable projects. Check each one's documentation to compare fit for your build setup.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
vcpkg suits C and C++ developers who need many third-party libraries, especially on Visual Studio, CMake, or MSBuild projects that benefit from manifests and binary caching. If you work in another language, or you need offline installs with no prior connected setup, look at other options such as Conan, Hunter, or CPM.cmake.
Install options & downloads