-
Since you force /DEBUG for the linker in release it generates PDBs which is great. It, however, ALSO disables /OPT:REF,ICF so you should be adding that back in.
-
The linker should use /CETCOMPAT for CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27
-
Compiler switch /guard:cf needs to be on for release
-
Compiler and linker should use /guard:ehcont for MSVC_VERSION GREATER_EQUAL 1928
-
Linker for release should use /INCREMENTAL:NO
-
The release build is missing /GF so it doesn't remove duplicate strings. Was this intentional?
See https://github.com/walbourn/directx-vs-templates/blob/main/build/CompilerAndLinker.cmake for a full set of switches and compiler versions.