Add modern MSVC security/optimization switches to msvc.cmake and clang.cmake#594
Draft
Add modern MSVC security/optimization switches to msvc.cmake and clang.cmake#594
Conversation
Agent-Logs-Url: https://github.com/RenderKit/embree/sessions/02dfbe47-c2bf-46f2-af93-e2f6a9855a0a Co-authored-by: stefanatwork <93931354+stefanatwork@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update msvc.cmake to include modern MSVC build switches
Add modern MSVC security/optimization switches to msvc.cmake and clang.cmake
Apr 14, 2026
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.
msvc.cmakewas missing several modern MSVC compiler and linker hardening/optimization flags, including control flow guard, CET compatibility, EH continuation metadata, and linker optimizations that/DEBUGimplicitly disables.Changes
/GF— Added toCOMMON_CXX_FLAGSfor all build types (eliminate duplicate strings)/guard:cf— Added to Release and RelWithDebInfo compiler flags (control flow guard)/INCREMENTAL:NO— Added to all linker configurations (Debug, Release, RelWithDebInfo)/OPT:REF /OPT:ICF— Added to Debug and RelWithDebInfo linker flags to restore optimizations suppressed by/DEBUG/CETCOMPAT— Added conditionally for MSVC ≥ 19.27 / clang-cl ≥ 13.0 on x64 (CET shadow stack)/guard:ehcont— Added conditionally for MSVC_VERSION ≥ 1928 / clang-cl ≥ 13.0 on x64, compiler + linker, Release and RelWithDebInfo onlyThe same changes are applied to the Windows section of
clang.cmakewith equivalent version guards.