diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt index 675da933d..eb3492ed5 100644 --- a/apps/openmw_test_suite/CMakeLists.txt +++ b/apps/openmw_test_suite/CMakeLists.txt @@ -26,4 +26,9 @@ if (GTEST_FOUND AND GMOCK_FOUND) if (UNIX AND NOT APPLE) target_link_libraries(openmw_test_suite ${CMAKE_THREAD_LIBS_INIT}) endif() + + if (BUILD_WITH_CODE_COVERAGE) + add_definitions(--coverage) + target_link_libraries(openmw_test_suite gcov) + endif() endif() diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index e2e6b97bb..a94119099 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -242,6 +242,11 @@ if (UNIX AND NOT APPLE) target_link_libraries(components ${CMAKE_THREAD_LIBS_INIT}) endif() +if (BUILD_WITH_CODE_COVERAGE) + add_definitions(--coverage) + target_link_libraries(components gcov) +endif() + # Make the variable accessible for other subdirectories set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE)