1、vcpkg\versions中查看所需要的版本号

2、在vcpkg.exe目录下创建vcpkg.json文件

3、编写文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"builtin-baseline":"", -- 随便输入一个,vcpkg会提示正确的,到时候修改就好了
"dependencies": [
{
"name": "jsoncpp" -- 库名
}
],
"overrides": [
{
"name": "jsoncpp", -- 库名
"version-string": "1.8.0" -- 需要的库版本
}
]
}
1
2
3
4
PS D:\sources\C++\vcpkg> vcpkg install
the top-level builtin-baseline (124) was not a valid commit sha: expected 40 hexadecimal characters.You can use the current commit as a baseline, which is:
"builtin-baseline": "eb8e75bb4f5b5f46f65cb10aa863285815c2b69c"
note: updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

4、在powershell中设置编译环境,这里示例为64位静态库版本 $env:VCPKG_DEFAULT_TRIPLET = 'x64-windows-static'

5、在vcpkg根目录下使用vcpkg install

6、完成后删除vcpkg.json文件