2025-02-13 06:52 AM - edited 2025-02-13 06:54 AM
The new CMake generation is great! It's very tastefully done (toochain file, presets, simple CMakeLists.txt, etc).
My request: I want to add some additional compiler flags (like `-Wconversion`) to my project.
In the top CMakeLists.txt I did:
```cmake
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE
"-Wconversion"
)
```
The problem is that it applies to the HAL as well, generating an endless stream of errors.
I could create a new cmake target for my own functions, but I wish the generated CMake template would support this out of the box.
Regards,
Gabriel
2025-02-13 08:03 AM - edited 2025-02-13 08:03 AM
Hello @fz_gabriel
Thank you for your contribution!
Have you tried to add the flags in gcc-arm-none-eabi.cmake file under the MCU specific flags section?
BR,
Souhaib
2025-02-13 10:05 AM
Hi Souhaib,
Thanks for your answer.
I would prefer not to touch the toolchain file.
In my opinion, the toolchain file should be reserved for making the toolchain work (i.e. providing the linker flags), not for project-specific development flags like `-Wshadow` or `-Wpedantic`.
In an ideal world, I could add development flags to everything except the ST-HAL and CMSIS Driver.
Does that make sense?
Best,
Gabriel