Skip to content

dk949/cpp-init

Repository files navigation

init cpp

CMake build and test

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).

Dependencies

Required

Optional

Usage

The project is setup as a template and needs to be setup before it can be used:

./setup.sh

Run setup.sh -h for more options

Configure cmake

cmake --preset default

Build the default target

cmake --build build

Build the release target

cmake --build build --config Release

Testing

Tests 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>_test

Coverage

This 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

About

cmake boilerplate for c++ projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published