好处
自动处理库依赖, 不需额外配置库 include路径 和库 lib路径
Applied user-wide integration for this vcpkg root.All MSBuild C++ projects can now #include any installed libraries.Linking will be handled automatically.Installing new libraries will make them instantly available.CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=F:/GIT/vcpkg/scripts/buildsystems/vcpkg.cmake"

安装
git clone https://github.com/Microsoft/vcpkg.gitcd vcpkgbootstrap-vcpkg.batvcpkg integrate install//安装jsoncpp 32位库 可省略冒号后内容vcpkg install jsoncpp 或vcpkg install jsoncpp:x86-windows//安装jsoncpp detours位库vcpkg install detours:x64-windows //安装//如果想在任意位置使用vcpkg 请把 vcpkg.exe 路径加入PATH环境变量中
新建个工程看配置中出现vcpkg即成功

有些文件可能下载失败
2022-2-21 23:58:33
这里我统一打包,放到对应 downloads目录下,可能过期
https://download.csdn.net/download/u012787710/81785983

vc 源文件中引用即可,不需额外配置了
#include <iostream>#include <windows.h>#include <detours/detours.h>#include <json/json.h>void main(){DetourTransactionBegin();Json::Reader reader;Json::Value root;if (reader.parse("{\"code\":200}", root)) {printf("code:%d\n", root["code"].asInt());// 200}system("pause");}

附录相关命令参数
vcpkg --helpCommands:vcpkg search [pat] Search for packages available to be builtvcpkg install <pkg>... Install a packagevcpkg remove <pkg>... Uninstall a packagevcpkg remove --outdated Uninstall all out-of-date packagesvcpkg list List installed packagesvcpkg update Display list of packages for updatingvcpkg upgrade Rebuild all outdated packagesvcpkg x-history <pkg> (Experimental) Shows the history of CONTROL versions of a packagevcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512vcpkg help topics Display the list of help topicsvcpkg help <topic> Display help for a specific topicvcpkg integrate install Make installed packages available user-wide. Requires adminprivileges on first usevcpkg integrate remove Remove user-wide integrationvcpkg integrate project Generate a referencing nuget package for individual VS project usevcpkg integrate powershell Enable PowerShell tab-completionvcpkg export <pkg>... [opt]... Exports a packagevcpkg edit <pkg> Open up a port for editing (uses %EDITOR%, default 'code')vcpkg create <pkg> <url> [archivename]Create a new packagevcpkg x-init-registry <path> Initializes a registry in the directory <path>vcpkg format-manifest --all Formats all vcpkg.json files. Run this before committing to vcpkg.vcpkg owns <pat> Search for files in installed packagesvcpkg depend-info <pkg>... Display a list of dependencies for packagesvcpkg env Creates a clean shell environment for development or compilingvcpkg version Display version informationvcpkg contact Display contact information to send feedbackOptions:--triplet=<t> Specify the target architecture triplet. See 'vcpkg help triplet'(default: %VCPKG_DEFAULT_TRIPLET%)--host-triplet=<t> Specify the host architecture triplet. See 'vcpkg help triplet'(default: %VCPKG_DEFAULT_HOST_TRIPLET%)--overlay-ports=<path> Specify directories to be used when searching for ports(also: %VCPKG_OVERLAY_PORTS%)--overlay-triplets=<path> Specify directories containing triplets files(also: %VCPKG_OVERLAY_TRIPLETS%)--binarysource=<path> Add sources for binary caching. See 'vcpkg help binarycaching'--x-asset-sources=<path> Add sources for asset caching. See 'vcpkg help assetcaching'--downloads-root=<path> Specify the downloads root directory(default: %VCPKG_DOWNLOADS%)--vcpkg-root=<path> Specify the vcpkg root directory(default: %VCPKG_ROOT%)--x-buildtrees-root=<path> (Experimental) Specify the buildtrees root directory--x-install-root=<path> (Experimental) Specify the install root directory--x-packages-root=<path> (Experimental) Specify the packages root directory--x-json (Experimental) Request JSON output@response_file Specify a response file to provide additional parametersFor more help (including examples) see the accompanying README.md and docs folder.
vcpkg help triplet
Available architecture triplets
VCPKG built-in triplets:
arm-uwp
arm64-windows
x64-linux
x64-osx
x64-uwp
x64-windows-static
x64-windows
x86-windows
VCPKG community triplets:
arm-android
arm-ios
arm-linux
arm-mingw-dynamic
arm-mingw-static
arm-neon-android
arm-windows-static
arm-windows
arm64-android
arm64-ios
arm64-linux
arm64-mingw-dynamic
arm64-mingw-static
arm64-osx-dynamic
arm64-osx
arm64-uwp
arm64-windows-static-md
arm64-windows-static
armv6-android
ppc64le-linux
s390x-linux
wasm32-emscripten
x64-android
x64-freebsd
x64-ios
x64-linux-release
x64-mingw-dynamic
x64-mingw-static
x64-openbsd
x64-osx-dynamic
x64-osx-release
x64-windows-release
x64-windows-static-md
x86-android
x86-freebsd
x86-ios
x86-mingw-dynamic
x86-mingw-static
x86-uwp
x86-windows-static-md
x86-windows-static
x86-windows-v120
