Skip to content

Calculator - C/C++ CMake + CTest course project template

A complete C/C++ template: CMake + CTest + googletest, every check reported twice (ReportGenerator and the native tool) on Windows and on Linux, Doxygen API docs, and this site tying it all together - a best-practice example for RTEU course projects.

Build and Test Pages Release Latest release License Line coverage (Windows) Line coverage (Linux) Doc. coverage (Windows) Doc. coverage (Linux)

Download the latest release Use this template View on GitHub

New here? Install -> Use the template -> From a topic to your project. The site is bilingual: use the language switcher in the header (English / Türkçe).

What is in this template

  • CMake + CTest + googletest


    A utility library, a calculator library (unit-tested infix/postfix parsing) and a calculatorapp command-line demo. Builds on Windows (Visual Studio or Ninja + MinGW) and Linux / WSL (Ninja + GCC).

    Install & first build

  • Every report, two ways, per platform


    Unit tests, code coverage and documentation coverage - each with ReportGenerator and with the native tool (OpenCppCoverage, lcov genhtml, gcovr) - built separately on Windows and Linux.

    Which report is which?

  • API docs (Doxygen)


    Libraries and test sources, for Windows and for Linux, with call and include graphs.

    API docs

  • One numbered script set


    6-build-and-test, 7-build-all, 9-open-site, 10-release ... the same number is the same job, with -windows.bat / -linux.sh as suffix. One project.env names the project.

    The scripts

  • Show it without GitHub Pages


    A private repository on GitHub Free has no Pages. 7-build-all + 9-open-site show the full site on http://localhost, and release/ holds every output. A checklist for the demo.

    Showing your project without Pages

  • Releases with every output


    release/ = the GitHub Release, one to one: app, libraries, every report, API docs, site.zip, source, ASSETS.md and SHA256SUMS.txt.

    Downloads

  • From topic to your own project


    A worked walkthrough: rename the sample in one place, add your modules, write the tests first.

    Topic to project

  • Troubleshooting, from real errors


    Real error messages met while building this template, and the exact fix for each.

    Troubleshooting

Reports, live

Each report has its own page in this site (a framed standalone HTML report with "Open in a new tab" and "Download (zip)"). Jump straight to one, or open the Reports tab:

Coverage ratios

Coverage type Windows Linux (WSL / CI Ubuntu)
Line Line Coverage Line Coverage
Branch Branch Coverage Branch Coverage
Method Method Coverage Method Coverage
Documentation Doc coverage Doc coverage

Build it yourself

# Windows (cmd.exe)                      # Linux / WSL
7-build-all-windows.bat                  ./7-build-all-linux.sh
9-open-site-windows.bat                  ./9-open-site-linux.sh     # serves the site on http://localhost:8000

Each full build takes roughly 10-20 minutes and produces reports/<platform>/, site/ and release/. Use 6-build-and-test-* for the fast build + unit test loop.