Skip to content

ryandday/cpp-template-project

Repository files navigation

cpp-template-project

Build Status CodeQL Status

A template repo to set up a project for a C++ library. Targeted for Linux or MacOS with gcc or clang.

Features

  • Includes robust project warnings for gcc and clang
  • Sanitizer options
  • Clang Tidy, cppcheck, and include-what-you-use support
  • Autogenerates documentation from the source code via Doxygen
  • Tests with gTest
  • Generates code coverage report from tests
  • Able to be included in a cmake project as a submodule, or with cmake FetchContent
  • After system installation, can be found in a cmake project with find_package
  • Optionally uses conan for dependency management, with ability to create conan package for the library from build artifacts.

Dependencies

Requires CMake to build.

For installing dependencies, either Conan or your favorite system package manager can be used.

For generating coverage reports, gcov and gcovr must be installed on the system.

The static analyzers must also be installed to use them.

Build

With conan

mkdir build
cd build
conan install ..
conan build ..

Without conan

Before building, install dependencies listed in build_requirements and requirements methods of conanfile.py.

cmake -S . -B build
cmake --build build

Misc commands

Run tests and generate code coverage reports from tests:

cmake --build build --target coverage

Install library on system after building:

cmake --install build

Contributing

Contributions that fix errata are much appreciated. Feel free to reach out to the author about any issues.

About

Template for C++ projects with gcc or clang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published