summaryrefslogtreecommitdiffstats
path: root/cmake/QtInternalTargets.cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2023-09-13 16:31:52 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2023-09-22 15:54:30 +0200
commit42d29441914da263a160d631f56c6d95f85eac70 (patch)
treededdaac9aa09de8189b9ea8a3c2e91d358cb5760 /cmake/QtInternalTargets.cmake
parentf2ec221bd62b8722915db9fc7dc3eb78991f6e6d (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 'cmake/QtInternalTargets.cmake')
-rw-r--r--cmake/QtInternalTargets.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake
index 043d2ca496..ec71ded359 100644
--- a/cmake/QtInternalTargets.cmake
+++ b/cmake/QtInternalTargets.cmake
@@ -361,6 +361,15 @@ if(QT_FEATURE_enable_new_dtags)
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE "-Wl,--enable-new-dtags")
endif()
+function(qt_internal_apply_coverage_flags)
+ if(QT_FEATURE_coverage_gcov)
+ target_compile_options(PlatformCommonInternal INTERFACE
+ "$<$<CONFIG:Debug>:-fprofile-arcs;-ftest-coverage>")
+ target_link_options(PlatformCommonInternal INTERFACE "$<$<CONFIG:Debug>:-lgcov;--coverage>")
+ endif()
+endfunction()
+qt_internal_apply_coverage_flags()
+
function(qt_get_implicit_sse2_genex_condition out_var)
set(is_shared_lib "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>")
set(is_static_lib "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>")