diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2023-09-13 16:31:52 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2023-09-22 15:54:30 +0200 |
commit | 42d29441914da263a160d631f56c6d95f85eac70 (patch) | |
tree | deddaac9aa09de8189b9ea8a3c2e91d358cb5760 /configure.cmake | |
parent | f2ec221bd62b8722915db9fc7dc3eb78991f6e6d (diff) |
Add coverage and coverage-gcov features
Features enable code coverage collecting using the gcov tool. The
resulting reports can then be post-processed by lcov or similar tools.
[ChangeLog][CMake][Coverage] Added the coverage configuration argument.
The only supported coverage tool at the moment is gcov. The argument
requires Qt is built in Debug otherwise setting the argument leads to
the configuration error. Typical usage:
<...>/configure -developer-build -coverage gcov
Task-number: QTBUG-86223
Change-Id: I39b2061f544997a7c4fe6f4d135c0ab447f15a17
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'configure.cmake')
-rw-r--r-- | configure.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.cmake b/configure.cmake index 508aa7782e..43fa7d4812 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1049,6 +1049,33 @@ qt_feature("intelcet" PRIVATE LABEL "Using Intel CET" CONDITION ( INPUT_intelcet STREQUAL yes ) OR TEST_intelcet ) + +if("${INPUT_coverage}" STREQUAL "gcov") + qt_config_compile_test(gcov + LABEL "gcov compiler flags" + COMPILE_OPTIONS "-fprofile-arcs -ftest-coverage" + CODE + "int main(void) + { + /* BEGIN TEST: */ + /* END TEST: */ + return 0; + } + ") +endif() + +qt_feature("coverage-gcov" + LABEL "Gcov" + ENABLE INPUT_coverage STREQUAL "gcov" + CONDITION TEST_gcov AND + ( QT_FEATURE_debug OR QT_FEATURE_debug_and_release ) +) + +qt_feature("coverage" + LABEL "Coverage" + CONDITION QT_FEATURE_coverage_gcov +) + qt_configure_add_summary_build_type_and_config() qt_configure_add_summary_section(NAME "Build options") qt_configure_add_summary_build_mode(Mode) |