SOLVED: Overriding Compiler Options in a Component
Posted: Thu Aug 19, 2021 9:36 pm
Hi, I'm trying to enable some compiler warnings and "treat warnings as errors" for our custom components.
I have added this to the CMakeLists.txt for the component:
I discovered that my extra options are being fed to the compiler, BUT it still doesn't fail on various warning such as unused function parameters. When I look at the full list of options when compiling one source file in the component, I see that it already has a number of warnings explicitly turned off, e.g.:
I guess these are overriding my attempt to turn these warnings ON?
How do I REMOVE these existing (inherited) compiler options that I don't want? I can't see where they are coming from.
Note I don't want to remove all existing compiler options (even if I could figure out how) because there are some which look important.
I have added this to the CMakeLists.txt for the component:
Code: Select all
target_compile_options(${COMPONENT_LIB} PRIVATE -Wall -Wextra -Werror)
Code: Select all
-Wno-sign-compare -Wno-unused-parameter
How do I REMOVE these existing (inherited) compiler options that I don't want? I can't see where they are coming from.
Note I don't want to remove all existing compiler options (even if I could figure out how) because there are some which look important.