Very similar situation to this post:
EDIT:
First off. I would modify your preset slightly.
"CMAKE_C_FLAGS_INIT": "/arch:AVX2 /openmp:experimental",
"CMAKE_CXX_FLAGS_INIT": "/arch:AVX2 /openmp:experimental"
Then in your CMakeLists.txt
do this after the first
project call.
project(FOOBAR)
string(REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
string(REPLACE "/Ob2" "/Ob3" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
By default CMake has default values for inlining on the MSVC compiler:
https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Platform/Windows-MSVC.cmake#L468
It maybe worth re-evaluating the defaults now that /Ob3 exists.
Or better yet, not specifying the default at all. Since /O2 implies /Ob2 by default with modern msvc compilers.
/O2
is equal to /Og /Oi /Ot /Oy /Ob2 /GF /Gy