Skip to content

Commit 9174fa1

Browse files
committed
cmake: enable coverage for debug
1 parent 1ad078c commit 9174fa1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
5151
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
5252
message(STATUS "Configuring hyprtoolkit in Debug")
5353
add_compile_definitions(HYPRTOOLKIT_DEBUG)
54+
set(BUILD_TESTING ON)
5455
else()
5556
add_compile_options(-O3)
5657
message(STATUS "Configuring hyprtoolkit in Release")
58+
set(BUILD_TESTING OFF)
5759
endif()
5860

5961
add_compile_definitions(HT_HIDDEN=public)
@@ -134,7 +136,7 @@ protocolnew("staging/linux-drm-syncobj" "linux-drm-syncobj-v1" false)
134136
protocolnew("protocols" "wlr-layer-shell-unstable-v1" true)
135137

136138
# Tests
137-
if(NOT DISABLE_TESTS)
139+
if(BUILD_TESTING)
138140
enable_testing()
139141

140142
# test apps
@@ -173,6 +175,10 @@ if(NOT DISABLE_TESTS)
173175
OpenGL::OpenGL PkgConfig::deps)
174176

175177
gtest_discover_tests(hyprtoolkit_tests)
178+
179+
# Add coverage to hyprtoolkit
180+
target_compile_options(hyprtoolkit PRIVATE --coverage)
181+
target_link_options(hyprtoolkit PRIVATE --coverage)
176182
endif()
177183

178184
# Installation

0 commit comments

Comments
 (0)