Page 1 of 1
Build flags for my code only
Posted: Fri Oct 01, 2021 9:27 am
by GreenGiant
Using:
Code: Select all
target_compile_options(${COMPONENT_LIB} PRIVATE -Wall -Wpedantic)
This is very handy however it flags issues with the IDF, which I don't really care about.
Is there an elegant way to confine the extra build flags to my project code/components ONLY and not IDF components, without needing to list all the source files as in:
Code: Select all
set_source_files_properties(<lots and lots of source files>.cpp
PROPERTIES COMPILE_FLAGS
-Wall -Wpedantic
)
Re: Build flags for my code only
Posted: Wed Oct 06, 2021 9:05 am
by GreenGiant
Just to add the why...
With these two flags there are a LOT of warnings, particularly in the use of anonymous structs, e.g.:
Code: Select all
/home/simon/_esp4v3/esp-idf/components/soc/esp32/include/soc/gpio_struct.h:187:9: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
};
^
/home/simon/_esp4v3/esp-idf/components/soc/esp32/include/soc/gpio_struct.h:196:9: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
};
^
/home/simon/_esp4v3/esp-idf/components/soc/esp32/include/soc/gpio_struct.h:206:9: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
};
...you get the point.
I don't mind if the IDF is non compliant, but I want my code to be.
Re: Build flags for my code only
Posted: Thu Oct 07, 2021 2:56 am
by ESP_Sprite
AFAIK, the private option thing should work. Are you sure that your issue isn't that your component includes those headers you mention (indirectly)? In that case, they'll still be compiled with the options you set for your component; you'd possibly be able to work around that with some #pragma commands, though.
Re: Build flags for my code only
Posted: Tue Oct 19, 2021 7:18 pm
by GreenGiant
Yep, that was exactly the issue, thanks. Pragmas have come to the rescue for now. Cheers