https://github.com/h-waldschmidt/cmake-vcpkg-template
Template for integrating vcpkg into a CMake project
https://github.com/h-waldschmidt/cmake-vcpkg-template
cmake cpp template vcpkg
Last synced: 5 months ago
JSON representation
Template for integrating vcpkg into a CMake project
- Host: GitHub
- URL: https://github.com/h-waldschmidt/cmake-vcpkg-template
- Owner: h-waldschmidt
- Created: 2023-09-16T10:52:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-12T18:18:49.000Z (almost 2 years ago)
- Last Synced: 2024-09-13T07:27:58.860Z (almost 2 years ago)
- Topics: cmake, cpp, template, vcpkg
- Language: CMake
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cmake-vcpkg-template
[](https://github.com/h-waldschmidt/cmake-vcpkg-template/actions/workflows/lint.yml)
[](https://codecov.io/gh/h-waldschmidt/cmake-vcpkg-template)
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.
## Cloning/Updating a repository which uses this template
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
```
## Building
1. `cmake --preset Debug`
2. `cmake --build --preset Debug`
## Coverage
1. `cmake --preset DebugTest`
2. `cmake --build --preset DebugTest --target coverage`
## Docker
TODO:
## Presets
1. **Debug:** Compile with debug information and no optimizations.
2. **RelWithDebInfo:** Compile with debug information and optimizations.
3. **Release:** Compile without debug information and with optimizations.
4. **DebugTest** Similar to `Debug` but with an additional `${PROJECT_NAME}_test` target, which runs all defined tests. Also adds `coverage` target, which generates HTML code coverage report.
5. **ReleaseTest** Same as `DebugTest`, but with optimizations and without debug information.
## Adding Dependencies
1. Check if dependencey is available with [vcpkg](https://vcpkg.io/en/packages)
2. Add dependency to `vcpkg.json`
3. Add corresponding lines to `CMakeLists.txt` (usually `find_package` and `target_link_libraries`)
4. Rebuild