chore: Change /Zi to /Z7 for ccache, remove debug symbols in CI (#6198)

As the `/Zi` compiler flag is unsupported by ccache, this change switches it to `/Z7` instead. For CI runs all debug info is omitted.
This commit is contained in:
Bart
2026-01-09 16:44:43 -05:00
committed by GitHub
parent 14467fba5e
commit 7c1183547a
4 changed files with 12 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ words:
- Btrfs
- canonicality
- checkme
- choco
- chrono
- citardauq
- clawback

View File

@@ -100,7 +100,7 @@ jobs:
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Prepare runner
uses: XRPLF/actions/prepare-runner@65da1c59e81965eeb257caa3587b9d45066fb925
uses: XRPLF/actions/prepare-runner@121d1de2775d486d46140b9a91b32d5002c08153
with:
enable_ccache: ${{ inputs.ccache_enabled }}

View File

@@ -46,6 +46,12 @@ set(CMAKE_VS_GLOBALS
"TrackFileAccess=false"
"UseMultiToolTask=true")
# By default Visual Studio generators will use /Zi, which is not compatible with
# ccache, so tell it to use /Z7 instead.
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
# By default Visual Studio generators will use /Zi to capture debug information,
# which is not compatible with ccache, so tell it to use /Z7 instead.
if (MSVC)
foreach (var_
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
string (REPLACE "/Zi" "/Z7" ${var_} "${${var_}}")
endforeach ()
endif ()

View File

@@ -44,6 +44,7 @@ if (MSVC)
# omit debug info completely under CI (not needed)
if (is_ci)
string (REPLACE "/Zi" " " ${var_} "${${var_}}")
string (REPLACE "/Z7" " " ${var_} "${${var_}}")
endif ()
endforeach ()