From 776cc8fc7d7ee99514ab2e515004fba63df60539 Mon Sep 17 00:00:00 2001 From: msclock Date: Thu, 14 Mar 2024 17:05:46 +0800 Subject: [PATCH] chore: exclude system directories from coverage (#68) * chore: exclude system directories from coverage * docs: typo changelog --- CHANGELOG.md | 2 +- cmake/ConfigureCoverage.cmake | 5 +++-- template/cmake/ConfigureCoverage.cmake | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 784143b0..fc9146d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ ### Build * optimize cmake tool file load ([#61](https://github.com/serious-scaffold/ss-cpp/issues/61)) ([f44a4b2](https://github.com/serious-scaffold/ss-cpp/commit/f44a4b2aa51a8a16dd34f3d46566b3bb8f94465a)) -* optimze build ([#60](https://github.com/serious-scaffold/ss-cpp/issues/60)) ([b99bd6b](https://github.com/serious-scaffold/ss-cpp/commit/b99bd6b83d16d4a7a816db4cb825a925247b0855)) +* optimize build ([#60](https://github.com/serious-scaffold/ss-cpp/issues/60)) ([b99bd6b](https://github.com/serious-scaffold/ss-cpp/commit/b99bd6b83d16d4a7a816db4cb825a925247b0855)) * simplify CMakePresets.json ([#62](https://github.com/serious-scaffold/ss-cpp/issues/62)) ([2172148](https://github.com/serious-scaffold/ss-cpp/commit/2172148cf30da79bb8e4e707133684c87c64c9d7)) diff --git a/cmake/ConfigureCoverage.cmake b/cmake/ConfigureCoverage.cmake index 94df47d4..88a6717f 100644 --- a/cmake/ConfigureCoverage.cmake +++ b/cmake/ConfigureCoverage.cmake @@ -15,8 +15,9 @@ include_guard(GLOBAL) include(cmake-modules/test/Coverage) list(APPEND _excludes "${CMAKE_BINARY_DIR}" "${VCPKG_INSTALLED_DIR}") -if(UNIX) - list(APPEND _excludes "/usr" "/usr/local" "/opt" "/opt/local") +# Exclude system directories from code coverage +if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + list(APPEND _excludes "/usr" "/opt" "/opt/local") endif() add_code_coverage_all_targets( diff --git a/template/cmake/ConfigureCoverage.cmake b/template/cmake/ConfigureCoverage.cmake index 94df47d4..88a6717f 100644 --- a/template/cmake/ConfigureCoverage.cmake +++ b/template/cmake/ConfigureCoverage.cmake @@ -15,8 +15,9 @@ include_guard(GLOBAL) include(cmake-modules/test/Coverage) list(APPEND _excludes "${CMAKE_BINARY_DIR}" "${VCPKG_INSTALLED_DIR}") -if(UNIX) - list(APPEND _excludes "/usr" "/usr/local" "/opt" "/opt/local") +# Exclude system directories from code coverage +if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + list(APPEND _excludes "/usr" "/opt" "/opt/local") endif() add_code_coverage_all_targets(