forked from espressif/esp-protocols
fix(mosq): Fix clean compilation addressing _GNU_SOURCE redefined
This commit is contained in:
@@ -82,3 +82,11 @@ idf_component_register(SRCS ${m_srcs}
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB} PRIVATE "WITH_BROKER")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
||||
# Some mosquittos source unconditionally define `_GNU_SOURCE` which collides with IDF build system
|
||||
# producing warning: "_GNU_SOURCE" redefined
|
||||
# This workarounds this issue by undefining the macro for the selected files
|
||||
set(sources_that_define_gnu_source ${m_lib_dir}/net_mosq.c ${m_src_dir}/loop.c ${m_src_dir}/mux_poll.c)
|
||||
foreach(offending_src ${sources_that_define_gnu_source})
|
||||
set_source_files_properties(${offending_src} PROPERTIES COMPILE_OPTIONS "-U_GNU_SOURCE")
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user