Closed emlai closed 4 years ago
Thanks for your report. This depends on the user perspective: I developed this module as something you explicitly enable, e.g.:
option(MY_CODE_COVERAGE_OPTION "Enable code coverage" OFF)
...
if(MY_CODE_COVERAGE_OPTION)
include(CodeCoverage)
...
endif()
And in this case I like the cmake run to fail if there is a dependency missing. Your point is completely valid but I would like to keep the current logic.
Thanks! I guess that would work for me as well.
Would be nice to have that in the documentation if that's the intended usage.
tldr: Allow the user to skip coverage target creation if gcov/lcov is not found.
Thank you for maintaining CodeCoverage.cmake, it has served me well over the last few years.
Now I'm facing an issue however: gcov is not found, and CodeCoverage.cmake aborts the whole CMake configuration process:
This is the corresponding line:
https://github.com/bilke/cmake-modules/blob/3e034039f71c6ce655b3e0ba2d32f2aeb7c8451b/CodeCoverage.cmake#L123-L125
My code looks like this:
As you can see, I want to skip the coverage target setup if lcov is not found. I don't think CMake allows recovering from FATAL_ERROR, so it would be nice if CodeCoverage.cmake supported this use case by allowing the user to handle the error instead of aborting.