I would like to add the ESP device itself to LWIP's local list of DNS entries. To do this I need to enable "dns_local_addhost()" by defining the "DNS_LOCAL_HOSTLIST_IS_DYNAMIC" macro (see lwip/dns.h). But I can't figure out how to do this via CMake.
It can't be done via sdkconfig.defaults because ESP doesn't expose it that way. It can't be done with component_compile_options() in my own component because that only turns it on for my component. I can't see how to enable this for the LWIP component and anything that depends on it (similar to the target_compile_definitions() CMake command with API or PUBLIC). How do I enable it?
(I'm only asking this because it seems to be the only way to have ESP resolve its own name/address via DNS. If there's a better way, post it to here.)
How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?
Re: How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?
Not even this seems to work (in the top level CMakeLists.txt, same one that has the project() def):
It sets the macro for my source files, but not for LWIP.
Code: Select all
component_get_target(LWIP_NAME lwip)
message(STATUS "LWIP target name: ${LWIP_NAME}")
target_compile_definitions(
${LWIP_NAME}
PUBLIC
DNS_LOCAL_HOSTLIST_IS_DYNAMIC
)
Re: How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?
Arg, I needed to define DNS_LOCAL_HOSTLIST as well! Putting this in the component or main CMakeLists.txt does the trick:
Code: Select all
component_get_target(LWIP_NAME lwip)
target_compile_definitions(
${LWIP_NAME}
INTERFACE
DNS_LOCAL_HOSTLIST
DNS_LOCAL_HOSTLIST_IS_DYNAMIC
)
Re: How do I enable LWIP's DNS_LOCAL_HOSTLIST_IS_DYNAMIC?
I realised later this was a pointless exercise since this enables DNS client calling code, not server. Still, now I know.
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot] and 109 guests