ESP-IDF component to set a compilation flag globally

RobMeades
Posts: 85
Joined: Thu Nov 29, 2018 1:12 pm

ESP-IDF component to set a compilation flag globally

Postby RobMeades » Thu Oct 12, 2023 1:29 am

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?

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

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

Postby chegewara » Tue Mar 19, 2024 4:26 pm

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

Who is online

Users browsing this forum: No registered users and 83 guests