Showing results for 
Search instead for 
Did you mean: 

Difficulties with CMake generated project with STM32CubeMX



I'm working on a CMake F030 based project, generated with STM32CubeMX (MX and firmware package up to date to last version)

So the CMakeList.txt link to a stm32cubemx library. Generating the basic project is ok.


But now, I have created a libPWM that is in its own directory, with it own CMakeList.txt. It add some compilation_option such as -Wconversion and -Werror

The pwmLib has to be linked to the stm32cubemx (for Driver include, cpu information...)

But as the stm32cubemx is an interface, when generating the libPWM, it rebuild the stm32cubemx (for example Libs/libPWM/CMakeFiles/libPWM.dir/__/__/Drivers/STM32F0xx_HAL_Dreiver/Src/stm32f0xx_hal_flash_ex.c.obj) The problem is that it use the compile options that were defined in libPWM (-WConversion -WError). And the compilation failed because there are conversion warning in Drivers.

How to avoid the stm32cubemx to be recompiled when linking to it, or how to avoid my compilation option to be propagate to the stm32cubemx lib when recompiled

Thank you





Is there someone that can explain to me why the STM32CubeMX generate a CMake project with a global stm32cubemx lib define as an interface?

Why not an executable for the Core directory linking to a static lib for the drivers?

The INTERFACE do not allow to change any compile option of any other lib linking to the stm32cubemx, which is every thing since it is the stm32cubemx that define driver and mcu define


Nobody at ST can help?