In your "Configuring build types" guide you specify "ZDebug" and "ZRelease" build types, but do not explain why these are used instead of the standard CMake "Debug" and "Release".
In this response to a question an engineer wrote:
The CMAKE_BUILD_TYPE is actually a special variable in cmake. Zephyr does not handle it, so if you use one of the values from the documentation cmake will take over and add some changes to variables used during the building process (for example cflags). You don't want this to happen as it may contradict definitions from kconfig.
I didn't want to introduce yet another variable so I reused cmake_build_type with "Z" prefix to build chose configuration. Since these are unknown to cmake it won't add anything specific by itself.
(At the moment I tend to think that it might have been better to introduce the new variable to have more flexibility and avoid confusion.)
I understand the reasoning behind this. If you use "Debug", Zephyr's CMake script emits a warning:
The CMake build type was set to 'Debug', but the optimization flag was set to '-Og'. This may be intentional and the warning can be turned off by setting the CMake variable 'NO_BUILD_TYPE_WARNING'
However, it is desirable to use the standard CMake build types – if you are adding custom CMake libraries to your target, these may do things in their CMakeLists.txt that expect the Debug and Release configurations to be used. For example:
add_compile_options($<$<CONFIG:Debug>:-DDEBUG=1>)
The warning from Zephyr makes it seem like we could just set the CMake variable "NO_BUILD_TYPE_WARNING" and use Debug and Release anyway. Looking at the pull request where this warning was added, if the current optimization flag matches CMake's default flags for the build type, the warning won't even be emitted, which suggests it's OK to use Debug and Release. I guess Zephyr's CMake scripts override everything in the predefined build type variables anyway, so there would be no conflict with predefined variables?