cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a lib to CMake project generated by STM32CubeMX

ANauz.1
Senior

Hello,

When generating a CMake project with STM32CubeMX, it generate a library stm32cubemx defined as an interface.

I created a libPWM. To have all the compile/CPU/drivers hal informations, my libPWM must be linked to the stm32cubemx.

To avoid error, in my lib I add compile option such as -Wconversion and -Werror. So in my libPWM CMakeLists.txt I have:

target_link_libraries( libPWM
PRIVATE
stm32cubemx
)

target_compile_option( libPWM PRIVATE
-Wconversion
-Werror
)

The problem is that, as the stm32cubemx is defined as an interface, when compiling the libPWM, it try to generate the stm32cubemx with the libPWM compile options. And as it is not perfect with conversion and other warning, it generate errors.

So how can I add my own library with its own compile option, linked to the stm32cubemx, without error.

Thank you for your help

 

 

 

0 REPLIES 0