`std_cmake_args` sets the `CMAKE_BUILD_TYPE` so you'll need to remove that on debug builds and leave it as-is for Release ones. Really though I'm not sure if I support having debug modes in formulae.