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 1: 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 2: The minimum required standard is C++17 (default since GCC 11 and Clang 16).

Dependencies

Required

Optional

Usage

Run the following commands to get started, more info available in the wiki.

Configure vcpkg

git clone "https://github.com/Microsoft/vcpkg.git"
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
./vcpkg/vcpkg install

Configure cmake

cmake --preset make # Check `cmake --list-presets` for other preset options

Build the default target

cmake --build build

Testing

Tests are enabled by default in debug mode and disabled by default in release. They can be explicitly controlled with -DBUILD_TESTING.

./build/bin/cpp_init_test
#or
ctest --test-dir build/tests

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 -DENABLE_COVERAGE=NO (off by default in release mode).

cmake --build build -t coverage

About

cmake boilerplate for c++ projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published