The following script creates a library with a function int add(int a, int b)
and a test application that links to the library and calls add
CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
project(CoverageTest)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp" "int add(int a, int b) { return a + b; }")