Library / SDK
TheLartians/ModernCppStarter avatar
TheLartians/ModernCppStarter

ModernCppStarter: a CMake template whose header repeats one Actions link five times

🚀 Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.

5,413 stars489 forksCMakeUnlicense

At a glance

What is it?
An Unlicense CMake template for C++ projects, with CPM.cmake dependency management, enforced clang-format, sanitizer and static analyzer toggles, ccache and Doxygen docs published on every release. Three small faults are worth knowing before you rename Greeter: the outer list file is written as CMakeList.txt, the docs step ends with a macOS-only command, and a patch release took fourteen months.
Who is it for?
ModernCppStarter is worth using for a library that intends to be installed, because the parts most templates skip are the parts it takes seriously: a real installable target with generated version headers, dependency pinning through CPM.cmake, formatting enforced in CI rather than by convention, and analyzers that pick up your own configuration. Two caveats come with it.
Can I use it commercially?
Yes. Unlicense is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 169 days ago.
What is it written in?
Mainly CMake, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • TheLartians/ModernCppStarter5,413 ★ · +6
Star history
Repository2026-09-232026-11-15
TheLartians/ModernCppStarter5.4k5.4k

6 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Five identical links sit above the title

The readme opens with five links in a row. All five point at the same address, the repository's GitHub Actions page, and then a sixth link goes to codecov.

It is a template, so this is a file that gets copied into every project that starts from it, and the duplication travels with it. Anyone who later edits the header has five identical lines to maintain instead of one, and a quick fix applied to the first will look applied while changing nothing visible.

The outer list file is written as CMakeList.txt

The usage section explains the modular layout: the outer file only defines the library itself, while the tests and other subprojects are self contained in their own directories. The sentence writes the file name as CMakeList.txt, without the trailing s.

That is a typo, and the same page links to CMakeLists.txt correctly twice, once in the usage list's header-only note and once in the header-only FAQ answer. So the file the sentence is describing exists and the sentence misnames it.

It matters more than a typo usually would, because this is the instruction a new user reads while deciding where to put library code. Someone who searches the repository for CMakeList.txt finds nothing and concludes the layout is flat, when in fact the point being made is the opposite, that the top level file defines the library and everything else lives in its own directory.

The documentation step ends with a macOS only command

Documentation is built automatically and published whenever a GitHub Release is created, so CI does not need local setup. The manual path is three lines:

bash
cmake -S documentation -B build/doc
cmake --build build/doc --target GenerateDocs
# view the docs
open build/doc/doxygen/html/index.html

The last line is where it stops being portable. `open` is a macOS command; on Linux the equivalent is a desktop specific opener and on a headless machine the file path is all you need. Every other command on the page, cmake configure, cmake build, the standalone binary, the test executable, is platform neutral.

The local prerequisites are also outside CMake: Doxygen, jinja2 and Pygments all have to be on the system. So the documentation workflow needs three host tools and its final step assumes a particular desktop.

The formatters are pinned to exact, dated versions

Formatting is enforced by clang-format and cmake-format, driven through Format.cmake, and the page says this requires clang-format, cmake-format and pyyaml on the current system. It then gives the install line with no versions left to chance:

bash
pip install clang-format==14.0.6 cmake_format==0.6.11 pyyaml

Two exact pins and one floating package. clang-format is pinned exactly at 14.0.6, so a project that installs a newer formatter locally will get different output from the one CI uses, and because formatting is enforced rather than suggested, that difference shows up as a failed check rather than a diff someone notices.

The cmake_format pin matters for the same reason, since that tool decides how your CMakeLists.txt files are laid out. The two format targets are separate, `format` to view changes and `fix-format` to apply them, which is a good habit for a template to model.

Every tool is a CMake configuration argument, not a script

The additional tools section works through one file, cmake/tools.cmake, which the test and standalone subprojects include so that extra tools can be pulled in on demand through configuration arguments. Nothing is enabled by editing the file.

Sanitizers come from USE_SANITIZER, which accepts Address, Memory, MemoryWithOrigins, Undefined, Thread or Leak, and combinations such as Address combined with Undefined written in quotation marks and separated by semicolons. Static analyzers come from USE_STATIC_ANALYZER with clang-tidy, iwyu or cppcheck, again allowing a semicolon separated list in quotes, and extra arguments through CLANG_TIDY_ARGS, IWYU_ARGS or CPPCHECK_ARGS. Ccache is a plain boolean, USE_CCACHE=ON or OFF.

One behaviour is worth knowing before you rely on it. By default the analyzers find their own configuration files, with .clang-format given as the example.

Renaming Greeter is case sensitive in three places

The first usage instruction is to use the repository as a template, then to replace every occurrence of Greeter in the relevant CMakeLists.txt with your project name. The page then spells out why that is more delicate than a search and replace.

Capitalisation matters: Greeter is the project name as CMake sees it, while greeter is what appears in file names. You have to rename the include/greeter directory to your own lowercase name and update every relevant include directive accordingly.

So a project called, say, Widget has three edits rather than one: the target names in the CMake files, the directory under include/, and the include paths that point into it. Miss the second and the third and the build fails on a path rather than on a name, which is at least a loud failure. The page also says you can remove unused files such as the standalone directory or irrelevant workflows once you have looked at them.

A patch release took fourteen months

The release line is small and slow in one stretch. v0.19.0 and v0.19.1 landed seven days apart in March 2025, then v0.19.2 arrived on 2026-05-30, the same day as the newest recorded commit. So a patch release sat behind two others for about fourteen months.

For a template that is less alarming than it looks, because nobody depends on a template's version, and the newest commit date and the newest tag matching means the current state of main is what a new project gets. It does mean the tag is a weak signal of activity, so the commit date is the one to read.

Two related facts from the same page. Documentation publishing is tied to release creation, so a quiet release line means documentation that refreshes rarely. And the licence is the Unlicense, a public domain dedication, which the usage section tells you to feel free to replace with one suited for your project.

The subproject layout makes each piece independently buildable

The tree explains the layout better than the prose does. The root holds a CMakeLists.txt, a .clang-format, a .cmake-format, a codecov.yaml and a cmake directory, and then six sibling directories: all, documentation, include, source, standalone and test.

The all directory is the one worth understanding first. Configuring it exposes every subproject to your IDE at once and avoids redundant rebuilds of the library, which is what makes development tolerable when the library is consumed by three separate subprojects:

bash
cmake -S all -B build
cmake --build build

# run tests
./build/test/GreeterTests
# format code
cmake --build build --target fix-format
# run standalone
./build/standalone/Greeter --help
# build docs
cmake --build build --target GenerateDocs

Every other directory also configures on its own, which is why the page gives a standalone recipe, a test recipe and a documentation recipe separately. A subproject you do not want is deleted, not disabled, along with the workflow that built it.

Editorial conclusion

ModernCppStarter is worth using for a library that intends to be installed, because the parts most templates skip are the parts it takes seriously: a real installable target with generated version headers, dependency pinning through CPM.cmake, formatting enforced in CI rather than by convention, and analyzers that pick up your own configuration. Two caveats come with it. The pinned formatter versions are old and exact, so a project on a current LLVM will either diverge from the template's output or spend time on a mismatch. And the documentation step ends with a command that only exists on macOS, so the local docs workflow needs changing on Linux before anyone tries it. Treat the Unlicense as a starting point rather than a decision, since the readme explicitly invites you to swap it, and expect to delete the standalone directory and the workflows you do not need before your first commit.

Frequently asked questions

What licence does ModernCppStarter ship, and can I change it?

The repository is released under the Unlicense, and the usage section says to feel free to replace the licence with one suited for your project. It is a starting point rather than a commitment.

How do I rename the Greeter project in ModernCppStarter?

Replace every occurrence of Greeter in the relevant CMakeLists.txt files, remembering that capitalisation matters: Greeter is the project name and greeter is used in file names. Rename the include/greeter directory to your own lowercase name and update all relevant include directives.

Does ModernCppStarter work for a header-only library?

Yes, with one change. You need to set the library type to an INTERFACE library as documented in the comments in CMakeLists.txt. The page points at TheLartians/StaticTypeInfo as an example header-only library built from the template.

How do I turn on sanitizers or static analyzers in ModernCppStarter?

With CMake configuration arguments handled by cmake/tools.cmake. USE_SANITIZER takes Address, Memory, MemoryWithOrigins, Undefined, Thread or Leak, USE_STATIC_ANALYZER takes clang-tidy, iwyu or cppcheck, and USE_CCACHE takes ON or OFF. Semicolon separated combinations go in quotation marks.

Can I build the docs locally in ModernCppStarter?

Yes, with Doxygen, jinja2 and Pygments installed on the system. Configure cmake -S documentation -B build/doc, build the GenerateDocs target, then open build/doc/doxygen/html/index.html. Note that the final open command is macOS specific.

Official sources

  1. License: Unlicense
  2. Project website
  3. README
  4. Releases
  5. TheLartians/ModernCppStarter on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/thelartians-moderncppstarter.svg)](https://hysenlabs.com/projects/thelartians-moderncppstarter)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/thelartians-moderncppstarter.svg)](https://hysenlabs.com/projects/thelartians-moderncppstarter)

Was this useful?