Page 1 of 1

ESP-IDF component to set a compilation flag globally

Posted: Thu Oct 12, 2023 1:29 am
by RobMeades
I would like to have an ESP-IDF component set a compilation flag that is effective on EVERYTHING in any build that component is included in: the main application, any other components, including components in the test subdirectory, absolutely everything, like appending a value to C_FLAGS might have done in ye olde Makefile days. I don't want to have to set up a dependency or the like to do this, no subtlety, I just want an utterly global short-cut.

How would I do that?

Re: ESP-IDF component to set a compilation flag globally

Posted: Tue Mar 19, 2024 4:26 pm
by chegewara
Example:

Code: Select all

idf_component_register(SRCS ${SRC_FILES} 
                    INCLUDE_DIRS include )

        
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-missing-field-initializers -Wno-deprecated-declarations -Wno-unused-variable)
bear in mind the order and PUBLIC