Disabling -Wno-error=unused-variable for main component
Posted: Fri Feb 16, 2024 3:24 pm
I have enabled -Werror for my main component, but during build something enables -Wno-error=unused-variable (seen on compile_commands.json) which causes unused var warnings to not be considered as errors.
As far as I can see, that is set in esp-idf\make\project.mk:390 (v4.4):
How can I override these without modifying esp-idf?
I have tried:
in project\main\CMakeLists.txt:
Both individually, and in combinations.
Thank you
As far as I can see, that is set in esp-idf\make\project.mk:390 (v4.4):
Code: project.mk Select all
# Warnings-related flags relevant both for C and C++
COMMON_WARNING_FLAGS = -Wall -Werror=all \
-Wno-error=unused-function \
-Wno-error=unused-but-set-variable \
-Wno-error=unused-variable \
-Wno-error=deprecated-declarations \
-Wextra \
-Wno-unused-parameter -Wno-sign-compareHow can I override these without modifying esp-idf?
I have tried:
in project\main\CMakeLists.txt:
Code: CMakeLists.txt Select all
target_compile_options(${COMPONENT_LIB} PRIVATE -Wall -Wextra -Werror -Wunused-variable)Code: CMakeLists.txt Select all
add_compile_options(-Wunused-variable)Code: CMakeLists.txt Select all
set_source_files_properties(main.c
PROPERTIES COMPILE_FLAGS
-Wunused-variable
)Both individually, and in combinations.
Thank you