You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add CMake version compatibility information as determined via (#47)
- `FIND_QUIETLY` option (#43)
- Extra flags to pass to `geninfo` and `lcov` (#45)
CMake module to enable code coverage easily and generate coverage reports with CMake targets
11
11
12
12
## Include into your project
13
13
@@ -36,21 +36,30 @@ For coverage evaluation you have to add ```coverage_evaluate()``` after all othe
36
36
37
37
To enable coverage support in general, you have to enable ```ENABLE_COVERAGE``` option in your CMake configuration. You can do this by passing ```-DENABLE_COVERAGE=On``` on your command line or with your graphical interface.
38
38
39
-
If coverage is supported by your compiler, the specified targets will be build with coverage support. If your compiler has no coverage capabilities (I asume intel compiler doesn't) you'll get a warning but CMake will continue processing and coverage will simply just be ignored.
39
+
If coverage is supported by your compiler, the specified targets will be build with coverage support. If your compiler has no coverage capabilities you will get a warning but CMake will continue processing and coverage will simply just be ignored. If you do not want these warnings to be printed, you might want to use the option `-Dcodecov_FIND_QUIETLY=ON`.
40
+
41
+
42
+
## Compatibility
43
+
44
+
CMake-codecov has been tested with CMake 3.10 up to 4.0 and works with `Unix Makefiles` and `Ninja` generators.
45
+
46
+
**Note:** When using the `Ninja` generator, CMake-codecov requires a version of CMake >= `3.21`.
47
+
48
+
40
49
41
-
####Compiler issues
50
+
### Compiler issues
42
51
43
52
Different compilers may be using different implementations for code coverage. If you'll try to cover targets with C and Fortran code but don't use gcc & gfortran but clang & gfortran, this will cause linking problems. To avoid this, such problems will be detected and coverage will be disabled for such targets.
44
53
45
54
Even C only targets may cause problems, if e.g. clang compiles the coverage for an older gcov version than the one is shipped with your distribution. [FindGcov.cmake](cmake/FindGcov.cmake) tries to find a compatible coverage evaluation tool to avoid this issue, but may fail. In this case you should check coverage with a different compiler or install a compatible coverage tool.
46
55
47
-
####File extensions
56
+
### File extensions
48
57
49
58
Starting with CMake `3.14`, this module will use the last file extension only (i.e. `.c` for `a.b.c`). Prior versions will use the full file extension starting with the first dot in the file name.
50
59
51
60
### Build targets with coverage support
52
61
53
-
To enable coverage support you have two options: You can mark targets explictly for coverage by adding your target with ```add_coverage()```. This call must be done in the same directory as your ```add_executable()```or ```add_library()``` call:
62
+
To enable coverage support you have two options: You can mark targets explicitly for coverage by adding your target with ```add_coverage()```. This call must be done in the same directory as your ```add_executable()```or ```add_library()``` call:
54
63
```CMake
55
64
add_executable(some_exe foo.c bar.c)
56
65
add_coverage(some_exe)
@@ -62,7 +71,7 @@ add_coverage(some_lib)
62
71
63
72
### Executing your program
64
73
65
-
To be able to evaluate your coverage data, you have to run your application first. Some projects include CMake tests - it might me a good idea to execute them now by ```make test```, but you can run your application however you want (e.g. by running ```./a.out```).
74
+
To be able to evaluate your coverage data, you have to run your application first. Some projects include CMake tests - it might be a good idea to execute them now by ```make test```, but you can run your application however you want (e.g. by running ```./a.out```).
0 commit comments