Modern project C++20 project template that uses CMake, Qt 6, QML, and vcpkg.
The project template is developed with the premise that the UI will be written entirely in QML to promote sepration of concerns. The UI should be split into distinct QML modules to encourage scalability and re-usability.
- There are much more thorough and more popular project templates out there. There's actually very little reason for you to use this, unless your needs are similar to mine. This template doesn't really try to be everything to everyone, it fits my use case, and doesn't contain a lot of stuff I don't need.
There are a number of pros to vcpkg:
- We get an actual package manager
- We don't need to use git submodules, CMake FetchContent, copy code into our repo, use a system package manager (usually), etc.
- We get slightly more reproducible builds, which is great.
It isn't without downsides:
- I genuinely can't get Qt to work via
vcpkgyet (at least on Linux) - even via a dependency manager building something like Qt from source is not for the faint of heart apparently. - So vcpkg is really here for any non-Qt dependencies
- CMake ≥ 3.21
- Ninja (at least by default, other build presets can be configured)
- C++20
- vcpkg
- Qt (sourced by you, through your OS package manager or some other means)
This project assumes you already have vcpkg installed - by cloning it somewhere, running the bootstrap script, and set the VCPKG_ROOT envrionment variable.
Release builds (using Ninja) can be created using:
cmake --preset=release
cmake --build --preset=releaseDebug builds (also with Ninja) can made with:
cmake --preset=debug
cmake --build --preset=debugTo do a fresh configure:
cmake --preset=release --freshOr to wipe away a build:
cmake --build --preset=release --target clean