CMAKE_BUILD_TYPE not passed to CMakeLists.txt for the generated project via STM32CubeMX
Hi,
I have setup and configured an STM32H5-based MCU via STM32CubeMX and with cmake as build system.
I managed to build it successfully using Ninja generator. However, I can't change the configuration to Release and it is always Debug even though I used -DCMAKE_BUILD_TYPE=Release.
I tried this in command line and using STM32 VSCODE Extension and all with the same results.
I even tried to pass -DCMAKE_CONFIGURATION_TYPES="Debug;Release".
Here is my build script:
@echo off
set TargetBuild=%1
:CHECK_INPUT
IF [%TargetBuild%] == [] GOTO :ERROR
:PROCESS
cd ../ &
rm -rf Secure/build &
rm -rf NonSecure/build &
rm -rf build
mkdir build &
cd build &
cmake -DCMAKE_CONFIGURATION_TYPES=%TargetBuild% -DCMAKE_BUILD_TYPE=%TargetBuild% -DCMAKE_TOOLCHAIN_FILE=gcc-arm-none-eabi.cmake -B%TargetBuild% -G Ninja -S../ &
cd %TargetBuild% &
ninja
goto :eof
:ERROR
echo "Error: No target build given"
echo "Usage Example:""
echo "_build.cmd Release"
goto :eof
