Warning "The CMake build type was set to 'MinSizeRel', but the optimization flag was set to '-Og'." when debug options are set

When I compile the attached example project like this:

west build --build-dir app/build app --pristine --board nrf52840dk/nrf52840 --sysbuild -- -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y

I get the following warning:

The CMake build type was set to 'MinSizeRel', but the optimization flag was set to '-Og'.

And the compile flags for main.c (taken from compile_commands.json) are:

-Os -DNDEBUG -Og

I don't understand where and why the CMAKE_BUILD_TYPE option gets set to MinSizeRel.

When I use the following command:

west build --build-dir app/build app --pristine --board nrf52840dk/nrf52840 --sysbuild -- -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DCMAKE_BUILD_TYPE=Debug

I get the following warning:

The CMake build type was set to 'Debug', but the optimization flag was set to '-Os'.

And the compile flags for main.c are:

Compile flags for main.c: -g -Og

I'm using the v2.9.0 of the SDK and the toolchain.

BR

Martin

0842.nordic.zip

Related