cmake boilerplate for a C++ project. Originally a fork of cpp starter project.
Note
This project is meant specifically for C++, it will likely take a lot of work to adapt it for use with C (or any other language).
Note
The minimum required standard is C++17 (default since GCC 11 and Clang 16).
- A C++ compiler
- cmake
The project is setup as a template and needs to be setup before it can be used:
./setup.shRun setup.sh -h for more options
cmake --preset defaultcmake --build buildcmake --build build --config ReleaseTests are enabled by default in debug mode and disabled by default in release.
They can be explicitly controlled with -D<PROJECT_NAME>_BUILD_TESTING.
./build/bin/Debug/<project_name>_testThis command will build (if not built) and run the tests then print a coverage report.
Coverage uses lcov. If lcov is not installed it tries to use nix to run
lcov. If neither is found an error is thrown. Disable coverage with
-D<PROJECT_NAME>_ENABLE_COVERAGE=NO (off by default in release mode).
cmake --build build -t coverage_<project_name>_test