bilke / cmake-modules

Additional CMake functionality. Most of the modules are from Ryan Pavlik (https://github.com/rpavlik/cmake-modules)
Boost Software License 1.0
542 stars 215 forks source link

gcovr commands now take the argument with path for gcov #63

Open jcbastosportela opened 2 years ago

jcbastosportela commented 2 years ago

When set(GCOV_PATH "path to my desired gcov executable")

this path won't be used by gcovr. It will instead use whatever gcov it finds in the system (if it does).

budhisagar commented 2 years ago

Hi I am new to UT and trying to use CodeCoverage.cmake but it not generate branch coverage report. Please help for getting branch coverage. Discription- I set up my project 'foo' in the following way. Copied the cmake file from the https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake to a subdirectory 'cmake_modules'. In the CMakeLists.txt file after the add_executable(foo ...) I added the following:

if(CMAKE_COMPILER_IS_GNUCXX) LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules") include(CodeCoverage) APPEND_COVERAGE_COMPILER_FLAGS() set(COVERAGE_LCOV_EXCLUDES 'dir1/' 'dir2/') // this is optional if you want to exclude some directory from the report SETUP_TARGET_FOR_COVERAGE_LCOV(NAME foo_coverage EXECUTABLE foo DEPENDENCIES foo) endif() After cmake, build the target make make foo_coverage And open the report with index.html file in the foo_coverage folder in the build folder

image