diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt index 1f9081747..66706bea3 100644 --- a/src/posix/platform/CMakeLists.txt +++ b/src/posix/platform/CMakeLists.txt @@ -35,6 +35,14 @@ if(OT_DAEMON) target_compile_definitions(ot-posix-config INTERFACE "OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE=1" ) + + # We have to add this definition to `ot-config` because openthread core + # libraries will set config file to "openthrad-core-posix-config.h" which + # depends on `OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE` to correctly enable + # PLATFORM_NETIF and PLATFORM_UDP features. Otherwise, openthread core and + # posix libraries will use different feature definitions. + list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE=1") + set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE) endif() option(OT_POSIX_INSTALL_EXTERNAL_ROUTES "Install External Routes as IPv6 routes" ON)