From 05046ca92513476310b91784979a4460e9480234 Mon Sep 17 00:00:00 2001 From: przemek83 <4788832+przemek83@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:50:43 +0100 Subject: [PATCH] Add missing CODE_COVERAGE flag support to CMake. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b64c6eb..4a9c6f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,13 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +option(CODE_COVERAGE "Collect coverage" OFF) + +if(CODE_COVERAGE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 --coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage") +endif() + find_package(Qt6 REQUIRED COMPONENTS Widgets Core Test) qt_standard_project_setup()