TExcelTAD
Home › C/C++ Packages: Conan 2, vcpkg & CPM.cmake › Manifest Mode & vcpkg.json

Manifest Mode & vcpkg.json

The manifest, vcpkg.json, is to vcpkg what conanfile.txt is to Conan: a committed list of what your project needs. It's JSON with a published schema, so editors can complete and validate it.

A complete manifest

json
{
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
  "name": "wordstat",
  "version": "1.0.0",
  "builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
  "dependencies": [
    "fmt",
    { "name": "spdlog", "default-features": false },
    { "name": "openssl", "platform": "!windows" }
  ],
  "features": {
    "tests": {
      "description": "Build the unit tests",
      "dependencies": [ "catch2" ]
    }
  },
  "overrides": [
    { "name": "fmt", "version": "12.2.0", "port-version": 1 }
  ]
}
Field Meaning
name, version optional for applications; required when the manifest is itself a port
builtin-baseline the vcpkg commit whose port versions you get (Baselines)
dependencies port names, or objects with features, default-features, platform, version>=, host
features optional parts of your project, each with its own dependencies
overrides force an exact version of a port, ignoring the baseline and constraints
supports platforms your project supports, e.g. "!uwp & !arm"

platform uses vcpkg's platform expressions: windows, linux, osx, android, x64, arm64, static, combined with &, | and !.

Starting a manifest

vcpkg new --application writes an empty vcpkg.json and a vcpkg-configuration.json whose default registry is the vcpkg GitHub repository at the current commit. That form fetches the registry from GitHub, which our offline container can't do, so this course uses the equivalent builtin-baseline field, which reads the local vcpkg clone. vcpkg add port edits the manifest for you:

bash · try it yourself
mkdir -p app && cd app
echo '{ "builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471" }' > vcpkg.json
vcpkg add port spdlog catch2
cat vcpkg.json
vcpkg format-manifest vcpkg.json > /dev/null && cat vcpkg.json
Succeeded in adding ports to vcpkg.json file.
{
  "builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
  "dependencies": [
    "spdlog",
    "catch2"
  ]
}
{
  "builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
  "dependencies": [
    "catch2",
    "spdlog"
  ]
}

vcpkg format-manifest rewrites the file in canonical order and formatting, which keeps diffs small when several people edit it.

Installing a manifest

bash · try it yourself
mkdir -p app && cd app
cat > vcpkg.json <<'JSON'
{
  "name": "app",
  "version": "1.0.0",
  "builtin-baseline": "5d4a3dc90c0b3773f3bac81bf41297b54328f471",
  "dependencies": [ "spdlog" ],
  "features": {
    "tests": { "description": "Build the unit tests", "dependencies": [ "catch2" ] }
  }
}
JSON
vcpkg install 2>&1 | grep -E 'will be built|^ +[*]? *[a-z0-9-]+(\[.*\])?:x64-linux|Restored|completed successfully'
echo "--- with the tests feature"
vcpkg install --x-feature=tests 2>&1 | grep -E 'already installed|will be|^ +[*]? *[a-z0-9-]+(\[.*\])?:x64-linux|Restored|completed successfully'
ls vcpkg_installed/x64-linux/lib
The following packages will be built and installed:
  * fmt:x64-linux@12.2.0#1
    spdlog[core,fmt,tz-offset]:x64-linux@1.17.0#1
  * vcpkg-cmake:x64-linux@2025-08-07
  * vcpkg-cmake-config:x64-linux@2026-07-21
Restored 4 package(s) from /opt/vcpkg-cache in 95.8 ms. Use --debug to see more details.
All requested installations completed successfully in: 25.3 ms
--- with the tests feature
The following packages are already installed:
  * fmt:x64-linux@12.2.0#1
    spdlog[core,tz-offset,fmt]:x64-linux@1.17.0#1
  * vcpkg-cmake:x64-linux@2025-08-07
  * vcpkg-cmake-config:x64-linux@2026-07-21
The following packages will be built and installed:
    catch2:x64-linux@3.16.0
Restored 1 package(s) from /opt/vcpkg-cache in 222 ms. Use --debug to see more details.
All requested installations completed successfully in: 14 ms
libCatch2.a
libfmt-c.a
libfmt.a
libspdlog.a
manual-link
pkgconfig
  • spdlog[core,fmt,tz-offset] shows the port's features that were selected: core always, plus spdlog's default features.
  • The second install lists what is already installed, then adds catch2 because the tests feature was requested; the packages already installed were kept. From CMake, the same switch is -DVCPKG_MANIFEST_FEATURES=tests.
  • Re-running vcpkg install is cheap: it compares what's installed with what the manifest asks for and only changes the difference.

What goes in Git

Path Commit?
vcpkg.json yes
vcpkg-configuration.json (registries, overlays) yes
vcpkg_installed/ no, it's generated
a lockfile vcpkg has none: the baseline commit plus your constraints and overrides fully determine the versions

That last row is a real design difference from Conan. A vcpkg manifest with a builtin-baseline is already reproducible: the same baseline always gives the same versions, because port versions at a given commit never change.

Test yourself

Which field makes a vcpkg manifest's versions reproducible?

  1. name
  2. builtin-baseline (or the default registry's baseline)
  3. features
  4. supports

How do you make a dependency apply only to non-Windows builds?

  1. Use a separate manifest
  2. { "name": "openssl", "platform": "!windows" }
  3. Put it in overrides
  4. It isn't possible

What does a manifest features entry describe?

  1. Features of vcpkg itself
  2. Optional parts of your project, each with extra dependencies, enabled with --x-feature or VCPKG_MANIFEST_FEATURES
  3. C++ language features
  4. Compiler flags