Skip to content
Public template

About

Production-ready C++ project template with modern standards, cross-platform builds, and integrated tooling

Topics

Resources

Code of conduct

Security policy

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

768 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmake_template

cmake_template logo

ci release

Run CI Run release Run docker build Run publish-docker Run Renovate

C++23 CMake template. Ninja Multi-Config, CPM, doctest + CTest, CPack. Presets for Linux, Windows, Android, and WebAssembly.

Quick start

cmake --preset linux_gcc_x86_64
cmake --build --preset linux_gcc_x86_64_release
ctest --preset linux_gcc_x86_64_release

Or replace the three steps with the linux_gcc_x86_64_release_package workflow preset for configure + build + test + package in one step.

What you get

  • 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

Demo

Quick start — configure, build, test:

Quick start: configure, build, test

Release in one command — release_package workflow with CPack:

One-command release_package workflow with CPack

Replayable sources and re-record instructions: assets/casts/.

Platforms

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.

Comparison

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

Layout

  • CMakeLists.txt — top-level only: presets, tests, packaging
  • cmake/presets/ — platform presets; cmake/toolchains/ — cross toolchains
  • cmake/cpm/ — dependency pins; cmake/cpack/ — packaging
  • src/ — examples (01_hello_world, 02_sdl3_app, …), one CMakeLists.txt per dir
  • tests/ — doctest suite

MIT — see license.md.

About

Production-ready C++ project template with modern standards, cross-platform builds, and integrated tooling

Topics

Resources

Code of conduct

Security policy

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages