how to make "/Ob3" flag set in preset not overrided by default "/Ob0" after

{
    "name": "windows-msvc",
    "hidden": true,
    "generator": "Ninja",
    "binaryDir": "${sourceDir}/out/build/${presetName}",
    "installDir": "${sourceDir}/out/install/${presetName}",
    "cacheVariables": {
        "CMAKE_C_COMPILER": "cl",
        "CMAKE_CXX_COMPILER": "cl",
        "CMAKE_TOOLCHAIN_FILE": {
            "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
            "type": "FILEPATH"
        },
        "CMAKE_C_FLAGS_INIT": "/arch:AVX2 /openmp:experimental /Ob3",
        "CMAKE_CXX_FLAGS_INIT": "/arch:AVX2 /openmp:experimental /Ob3"
    },
    "condition": {
        "type": "equals",
        "lhs": "${hostSystemName}",
        "rhs": "Windows"
    }
}

Command line warning D9025: overriding ‘/Ob3’ with ‘/Ob0’

compile command

{
  "directory": "C:/workspace/Design/out/build/msvc-Debug",
  "command": "C:\\PROGRA~1\\MICROS~1\\2022\\COMMUN~1\\VC\\Tools\\MSVC\\1434~1.319\\bin\\Hostx64\\x64\\cl.exe  /nologo /TP -IC:\\workspace\\Design\\fmt\\include /Ob3 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd -std:c++20 /Fofmt\\CMakeFiles\\fmt.dir\\src\\format.cc.obj /FdTARGET_COMPILE_PDB /FS -c C:\\workspace\\Design\\fmt\\src\\format.cc",
  "file": "C:\\workspace\\Design\\fmt\\src\\format.cc"
}

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