Disable warnings as errors
Posted: Sun Sep 21, 2025 8:21 pm
Hi,
I'm having this extremely annoying issue where esp-idf forces down my throat its compiler warnings as errors. In the specific case I have
error: 'virtual void Motor::run()' was hidden [-Werror=overloaded-virtual=]
I tried to disable this behaviour (together with setting my own flags) in the root CMakeLists.txt:
However the problem is still there, moreover this sets the flags for all the files, including IDF components, compilation is slow as hell because of the thousands of warnings, and sometime the components themselves fail to compile.
Same result if I try to fix it in the main/CMakeLists.txt like this:
So, how do I set the compiler flags that I want so that my code is compiled according to my warning/error policy and not the one that IDF is using?
Bye
Andrea
I'm having this extremely annoying issue where esp-idf forces down my throat its compiler warnings as errors. In the specific case I have
error: 'virtual void Motor::run()' was hidden [-Werror=overloaded-virtual=]
I tried to disable this behaviour (together with setting my own flags) in the root CMakeLists.txt:
Code: Select all
idf_build_set_property(COMPILE_OPTIONS "-Wall" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wextra" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wpedantic" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Weffc++" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wno-error=all" APPEND)
Same result if I try to fix it in the main/CMakeLists.txt like this:
Code: Select all
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wall" "-Wextra" "-Wpedantic" "-Weffc++" "-Wno-error=all")
Bye
Andrea