From 520242b90cbe270792aabe1e94044cbd919c2b62 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 29 May 2026 19:45:32 +0100 Subject: [PATCH] Add config for measuring code coverage using MSVC 2026 It may work for older versions of MSVC, but before 2026 it wasn't available in the Community edition. --- cpp/.runsettings | 47 ++++++++++++++++++++++++++++++++++++++++++++++ cpp/CMakeLists.txt | 6 ++++++ 2 files changed, 53 insertions(+) create mode 100644 cpp/.runsettings diff --git a/cpp/.runsettings b/cpp/.runsettings new file mode 100644 index 00000000..5f3b0228 --- /dev/null +++ b/cpp/.runsettings @@ -0,0 +1,47 @@ + + + + + + + + coverage + Cobertura + + + + .*\.dll$ + + + .*googletestadapter\.(common|core|testadapter)\.dll + + + + + + ^rust::cxxbridge1::.* + + + + + + + True + + True + + True + + False + + True + + True + + True + + + + + + diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 6856149b..acda478a 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -253,6 +253,12 @@ if(MSVC) "/sdl" "$<$:/RTC1>") target_link_options(libloot PRIVATE "/INCREMENTAL:NO" "/LTCG") + + # Copy test code coverage config into build directory where MSVC expects to + # find it. + configure_file("${PROJECT_SOURCE_DIR}/.runsettings" + "${PROJECT_BINARY_DIR}/.runsettings" + COPYONLY) endif() ##############################