C++23 CMake template. Ninja Multi-Config, CPM, doctest + CTest, CPack. Presets for Linux, Windows, Android, and WebAssembly.
cmake --preset linux_gcc_x86_64
cmake --build --preset linux_gcc_x86_64_release
ctest --preset linux_gcc_x86_64_releaseOr replace the three steps with the linux_gcc_x86_64_release_package workflow preset for configure + build + test + package in one step.
- C++23, target-based CMake, no glob, no global flags
- Dependencies via CPM, pinned tags (optional vcpkg manifest overlay)
- Tests: doctest + CTest, JNI harness for Android
- Packaging: CPack (TGZ/ZIP/TXZ)
- Quality: clang-format, clang-tidy (native only), pre-commit
Quick start — configure, build, test:
Release in one command — release_package workflow with CPack:
Replayable sources and re-record instructions: assets/casts/.
| Target | Configure preset | Notes |
|---|---|---|
| Linux x86_64 | linux_gcc_x86_64, linux_clang_x86_64 |
Native, full test + package |
| Linux x86_64 (vcpkg) | linux_gcc_x86_64_vcpkg |
Same tree, deps from vcpkg.json manifest; needs VCPKG_ROOT |
| Linux sanitizers | linux_*_asan, *_ubsan, *_tsan, *_asan_ubsan |
Debug only, no package; e.g. cmake --preset linux_clang_x86_64_asan && cmake --build --preset linux_clang_x86_64_asan_debug && ctest --preset linux_clang_x86_64_asan_debug |
| Linux Valgrind | linux_*_valgrind |
Debug only; tests run under memcheck via the _valgrind_debug test preset (or built-in ctest --test-dir build/<preset> -C Debug -T memcheck) |
| Windows x86_64 | windows_msvc_x86_64 |
Native, Visual Studio 17 2022 |
| Windows x86_64 (vcpkg) | windows_msvc_x86_64_vcpkg |
Same tree, deps from vcpkg.json manifest; needs VCPKG_ROOT |
| Windows cross (from Linux) | windows_llvm_mingw_x86_64, _x86, _aarch64 |
llvm-mingw toolchain, no tests |
| Android | android_clang_aarch64, _armv7, _x86_64, _x86 |
NDK, API 24, c++_shared; tests via ./gradlew connectedCheck in android_project/ |
| WebAssembly | web_emscripten_wasm32 |
Emscripten toolchain, SDK bootstrapped to .emsdk/; tests under Node.js |
Release via the release workflow: builds all platforms, tags, attaches artifacts.
Docker images (fedora, alt) are manual only: run docker_ci (build + verify) or docker_publish (push to GHCR) — or tick publish_docker in a release run.
| Feature | cmake_template | cpp-best-practices | modern-cpp-template | cmake-init |
|---|---|---|---|---|
| C++ Standard | 23 / 26 | 17 / 20 | 17 | 11+ |
| CMake Presets | ✅ 10+ with workflows | ❌ | ❌ | ❌ |
| Android NDK | ✅ 4 presets, 64-bit CI | ❌ | ❌ | ❌ |
| Android instrumented tests | ✅ GMD + doctest JNI | ❌ | ❌ | ❌ |
| Linux → Windows cross | ✅ llvm-mingw (3 arch) | ❌ | ❌ | ❌ |
| WebAssembly | ✅ Emscripten (SDL3 + ImGui + OpenGL demo) | ✅ + Pages deploy | ❌ | ❌ |
| Docker / CI | ✅ + Actions matrix | ✅ Docker + Actions | ✅ GitHub Actions | ✅ |
| CPack packaging | ✅ tar.gz / zip / txz | ❌ | ❌ | ❌ |
| Sanitizers | ✅ ASan/UBSan/TSan + Valgrind presets | ✅ ASan/UBSan | ✅ | ❌ |
| Fuzz testing | ❌ | ✅ libFuzzer | ❌ | ❌ |
| Code coverage | ❌ #10 | ✅ codecov | ✅ codecov | ❌ |
| vcpkg | ✅ manifest (optional overlay, #3) | ❌ | ❌ | ❌ |
| License | MIT | Unlicense | Unlicense | MIT |
CMakeLists.txt— top-level only: presets, tests, packagingcmake/presets/— platform presets;cmake/toolchains/— cross toolchainscmake/cpm/— dependency pins;cmake/cpack/— packagingsrc/— examples (01_hello_world,02_sdl3_app, …), oneCMakeLists.txtper dirtests/— doctest suite
MIT — see license.md.


