How lectem/cpp-boilerplate works
Project type and purpose
• This is a C++ “modern CMake” boilerplate/template project. It isn’t an end-user application but a reusable foundation that showcases a “best-practice” build setup using CMake 3.x, common C++ libraries (fmt, spdlog), unit testing (doctest), and CI/CD integration.
File structure
• Top‐level folders:
• cmake/ → custom CMake scripts (warnings, LTO, coverage, DLL fixups, CI helpers)
• external/ → submodules for fmt, spdlog, doctest
• / → public headers (foo.h)
• source/ → implementation files and main.cpp
• tests/ → unit tests (failtest.cpp, successtest.cpp)
• .github/workflows → GitHub Actions workflows
• Key files: CMakeLists.txt (entry point for build), CreateBoilerPlate.sh (bootstrapping), appveyor.yml, CodeQL config, .clang-format.
README for additional insights
• Purpose: teach/boot- strap new CMake projects, illustrate modern CMake patterns, CI integration (GitHub Actions, AppVeyor, Codecov, CDash).
• Dependencies: C++14, Git (for submodules), external libs (fmt, spdlog, doctest).
Main components
a. Code Base
• Source Module: include/ + source/ → produces library or executable (foo library + main)
• Test Module: tests/ → linked against library, uses doctest
b. Build System
• CMake Core (CMakeLists.txt)
• Custom CMake Scripts (cmake/*.cmake)
• External Submodules (external/{fmt,spdlog,doctest})
c. CI/CD Infrastructure
• GitHub Actions workflow (.github/workflows/cmake.yml)
• AppVeyor (appveyor.yml)
• CodeQL (code scanning)
• Codecov & CDash (coverage & test dashboards)
d. Developer Workflow
• Developer clones repo → runs CreateBoilerPlate.sh → edits CMakeLists + code → commits → CI pipelines execute
Relationships and data flows
• Developer pushes code to GitHub → triggers GitHub Actions & CodeQL
• Build System (CMake) configures & generates native build files → compilers compile code + link external libs → binaries produced
• CTest runs unit tests via doctest → test results sent to CDash
• Coverage instrumentation (Coverage.cmake) → coverage reports sent to Codecov
• On Windows builds: CopyDllsForDebug.cmake copies DLLs for runtime
Architectural patterns and design principles
• Single orchestrator (CMake) managing multi‐platform builds
• Submodules for small dependencies (fmt, spdlog, doctest) to simplify bootstrapping
• Modular CMake scripts for cross-project reuse (warnings, LTO, coverage)
• Clear separation between code, tests, build logic, and CI configuration
Detail
• Every top‐level folder or script that plays a role in the build or CI pipeline.
• Platform-specific behavior (windows-only.cpp + CopyDllsForDebug.cmake).
• Both local (developer workstation) and remote (GitHub, AppVeyor, Codecov) stages.
1) the modular CMake-driven build architecture,
2) how external libraries are included,
3) where tests and coverage fit in, and
4) how CI/CD orchestrates the entire lifecycle of this boilerplate project.