Template for integrating vcpkg into a CMake project Also includes multiple presets for building and activates compiler warnings.
Make sure ninja
is installed for building.
Remember to recursively clone the repository to include vcpkg
.
git clone --recursive https://github.com/h-waldschmidt/cmake-vcpkg-template.git
To update the vcpkg
submodule do:
git submodule update --remote --merge
cmake --preset Debug
cmake --build --preset Debug
cmake --preset DebugTest
cmake --build --preset DebugTest --target coverage
TODO:
- Debug: Compile with debug information and no optimizations.
- RelWithDebInfo: Compile with debug information and optimizations.
- Release: Compile without debug information and with optimizations.
- DebugTest Similar to
Debug
but with an additional${PROJECT_NAME}_test
target, which runs all defined tests. Also addscoverage
target, which generates HTML code coverage report. - ReleaseTest Same as
DebugTest
, but with optimizations and without debug information.
- Check if dependencey is available with vcpkg
- Add dependency to
vcpkg.json
- Add corresponding lines to
CMakeLists.txt
(usuallyfind_package
andtarget_link_libraries
) - Rebuild