From 6afc1dc3a05d43c5f56d4378f89eb7de4f545bb2 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 8 Jul 2018 20:27:46 +0300 Subject: [PATCH] Support build with coverage for components and test suite --- apps/openmw_test_suite/CMakeLists.txt | 5 +++++ components/CMakeLists.txt | 5 +++++ 2 files changed, 10 insertions(+) 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)