Using vcpkg#
Note
This documentation is the same documentation that would be generated for your project when using
new_cxx_project. The term ${project_name} will be replaced with your project’s designated
name.
${project_name} uses vcpkg for package management. We use the manifest mode.
Adding packages#
To add a dependency, add it to the top-level vcpkg.json, and then add the corresponding CMake
find_package (or equivalent) rule to config/cmake/add_packages.cmake.
Setting up the toolchain with vcpkg#
This project aims to build its dependencies with the same compile-time options as its own targets,
where possible (Titus Winters’ keynote, ‘C++ Past vs. Future’,
summarises why we adopt this philosophy). ${project_name} generates a vcpkg toolchain file when you
configure the project, so you shouldn’t follow the vcpkg instructions for setting things up. Instead,
just configure the project using the options documented in Using CMake. You can optionally set
-DVCPKG_INSTALL_OPTIONS, which will be passed to vcpkg.
-DVCPKG_INSTALL_OPTIONS='--clean-after-build'
option is optional, and tells vcpkg to clean its build cache after all packages are installed.#$ cmake -S. -Bbuild -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DTOOLCHAIN_FILE='/path/to/project/config/cmake/toolchains/x86_64-unknown-linux-llvm.cmake' \
-DVCPKG_INSTALL_OPTIONS='--clean-after-build' \
<project options...>