fix(build): fix /Z7 /Zi conflict in Debug on Windows - #692
Open
JalinWang wants to merge 1 commit into
Open
Conversation
JalinWang
marked this pull request as ready for review
August 21, 2026 02:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Windows Debug/RelWithDebInfo builds emit thousands of warnings:

What Happens
1. What the top-level
CMakeLists.txtdid. Get/Z7by string-replacing/Ziinside the config flag variables:2. But there is no
/Ziin those variables — the replace is a no-op:3. Why. We require CMake 3.26, so
CMP0141=NEW. Since CMake 3.25 the debug information format is no longer part ofCMAKE_<LANG>_FLAGS_<CONFIG>; it is driven byCMAKE_MSVC_DEBUG_INFORMATION_FORMAT(defaultProgramDatabase=/Zi) and appended near the end of the compile command — note the dash form-Zi, emitted next to-MTd, which is exactly how CMake's flag abstractions are written.4. Result. Every TU gets
/Z7early and-Zilate (build_/d/compile_commands.json):cl : Command line warning D9025 : overriding '/Z7' with '/Zi', repeated across everymodule that either got a
/Zi→/Z7patch or hardcodes/Z7:thirdparty/antlr/antlr4.windows.patch,rocksdb-8.1.1/CMakeLists.txt#L189,googletest internal_utils.cmake#L75.MSVC applies the last flag, so
/Ziwins — including for our own sources:So Debug/RelWithDebInfo builds were still producing per-target compile-time
.pdbfiles, while Release — the config CI builds — was not affected the same way: MSVC Release flags
carry no
/Zi.Fix
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT = "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>".set(CMAKE_POLICY_DEFAULT_CMP0141 NEW)beforeproject(), so thirdparty subdirectories declaring an oldercmake_minimum_requiredhonour it too.