The cmake crate strips -O*/O* from CFLAGS and, with no explicit generator on MSVC, overwrites CMAKE_C_FLAGS_RELEASE — so the previous CFLAGS=/O2 attempt could never work (verified: /DNDEBUG survived, /O2 stripped). With CMAKE_GENERATOR=Ninja the override branch is skipped and CMake's default Release flags (/O2 /Ob2 /DNDEBUG) reach ggml.