CMake Errors If STM32CubeMX Project Name Contains Spaces
I was following the tutorial (Get started with STM32Cube for VS Code: from installation to debugging - YouTube) when I managed to find a nasty footgun. STM32CubeMx will allow you to create a project whose name contains a space, and then if you set the toolchain to CMake, it generates the code fine, but if you load the project into STM32Cube for VSC and try to build, you will get all kinds of cryptic CMAKE error messages caused by the space in the project name.
Now, STM32CubeMx does have some input validation. It only prevents you from initially generating the project IF you have space in the name and you set the toolchain to CMake BEFORE you generate the code, but that's it. If you save the IOC with a space, save the project as with a space, you generate under any of the other toolchains then switch to CMake, you'll trigger this error.
I burned a few hours on this, so I thought it would be worth bringing up to save someone else the headache in the future. You might want to implement some sort of detection for projects with spaces so you can catch the error early. Given that STM32CubeMx + VSC seems to be the happy path moving forward, I'd also be updating the STM32CubeMx to at a minimum throw an error when generating CMake projects when the name contains a space, and possible enforcing no spaces in project names across all toolchains.
Anyway, in the end I figured out the error and I've got it working on both MacOS and Win11. The integration into VSC is amazing, working very smoothly!
