cpp.mk

cpp-lint

Synopsis: make cpp-lint

Hooks: cpp-pre-lint, cpp-post-lint

Runs a comprehensive linting process for the C++ project using modern static analysis tools. This target performs the following: - Creates or reuses the build directory. - Configures the CMake build environment in Debug mode using project name and version. - Runs iwyu_tool (Include What You Use) to detect unnecessary or missing includes. - Runs cppcheck with the provided compile database to detect potential bugs and style issues. - Runs run-clang-tidy with a curated set of checks including cppcoreguidelines, performance, readability, modernization, misc, Clang Analyzer, and Google style checks. Output reports are saved to the build directory: - build/iwyu_tool.out - build/cppcheck.out - build/run-clang-tidy.out Optional pre- and post-lint hooks (cpp-pre-lint and cpp-post-lint) can be defined for additional custom logic.

cpp-build

Synopsis: make cpp-build

Hooks: cpp-pre-build, cpp-post-build

Variables:

Variable

Description

VAR

variable

build check project cpp code in the given directories/files using .

cpp-test

Synopsis: make cpp-test

Hooks: cpp-pre-test, cpp-post-test

Executes the C++ test suite for the project using an external test runner and coverage tools. This target performs the following: - Verifies that required scripts (CPP_TESTS_SCRIPT and CPP_COVERAGE_SCRIPT) are defined. - Parses a clean semantic version string from VERSION for use in test metadata. - Configures a CMake Debug build using project name and version. - Enters the designated test directory and executes the provided test script with verbose output. - Runs the code coverage script and saves the output report into the gcov folder. Output: - Test logs (stdout/stderr) from the test script - Coverage report written to gcov/``$(TEE_OUTPUT_FILE)`` Optional pre- and post-test hooks (cpp-pre-test and cpp-post-test) can be defined to run custom logic before and after this target.