fix: Revert CMP0141 policy, scope to test infrastructure only#1630
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f4300aa. Configure here.
3442a21 (#1610) added CMP0141 NEW for sccache support. This policy defaults CMAKE_MSVC_DEBUG_INFORMATION_FORMAT to ProgramDatabase (/Zi) for Debug and RelWithDebInfo configurations: https://cmake.org/cmake/help/latest/policy/CMP0141.html This causes static libraries to reference an external PDB. Since static libraries are distributed without a PDB, consumers get LNK4099 warnings when linking, which breaks builds using MSBuildTreatWarningsAsErrors or TreatWarningsAsErrors. Set the MSVC_DEBUG_INFORMATION_FORMAT target property to Embedded (/Z7) for static builds so debug types are embedded directly in the .obj files and no external PDB is needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensures the compiler PDB lands in the build root with multi-config generators (Visual Studio), so the sentry.pdb assertion in test_build_static checks the correct path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use a generator expression to avoid adding /Z7 to Release and MinSizeRel configurations where debug info is not needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I have the feeling that when Adding this change introduces a round-trip workaround to something that wasn't necessary in the first place (unless we actually document this as a breaking change).
So, to disentangle this, we have two coarse options: Option A: Revert
No breaking change. sentry-dotnet's toolchain continues to work. No minimum CMake version implications. Option B: Keep If we decide
|
The top-level CMP0141 policy broke downstream consumers (e.g. sentry-dotnet) that rely on flag-based debug info control. Move the policy and CMAKE_MSVC_DEBUG_INFORMATION_FORMAT to the test fixture where sccache needs it, and remove the /Z7 target property and PDB assertion that were added alongside it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I'm painfully aware that this was a breaking change that should never have been merged. Enabling CMP0141 without fully understanding its downstream consequences was a bad idea. Thank you for helping to fix the screw-up. 🙏 |
I think we've seen worse unintentional breakage very recently 😅. In any case, just as a reminder: whenever we twist CMake policies, it is likely a breaking change for the build of someone (and since this repo offers only a source distribution, breaking the build contract means signaling it in the version, at least I always tried to handle it this way). We could add something like this in an agents.md (or the contribution docs). CMake policies must always be considered globally, as with changes to minimum version requirements, even if they appear trivially minimal. I think we should immediately trigger a fix release for this. |
…try#1630) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

The top-level
CMP0141policy broke downstream consumers (e.g. sentry-dotnet) that rely on flag-based debug info control. This PR reverts the policy from the library build and scopes it to the test fixture where sccache actually needs it.cmake_policy(SET CMP0141 NEW)fromCMakeLists.txtand test fixture CMakeListsMSVC_DEBUG_INFORMATION_FORMATtarget property from the sentry targetCMAKE_POLICY_DEFAULT_CMP0141=NEWfromtests/cmake.pyonly when sccache is activeSee also: