diff --git a/drivers/ethernet/CMakeLists.txt b/drivers/ethernet/CMakeLists.txt index a8fec09900e..40227dfb30f 100644 --- a/drivers/ethernet/CMakeLists.txt +++ b/drivers/ethernet/CMakeLists.txt @@ -8,7 +8,14 @@ zephyr_sources_ifdef(CONFIG_ETH_DW eth_dw.c) zephyr_sources_ifdef(CONFIG_ETH_ENC28J60 eth_enc28j60.c) zephyr_sources_ifdef(CONFIG_ETH_MCUX eth_mcux.c) zephyr_sources_ifdef(CONFIG_ETH_STM32_HAL eth_stm32_hal.c) -zephyr_sources_ifdef(CONFIG_ETH_NATIVE_POSIX - eth_native_posix.c - eth_native_posix_adapt.c - ) + +if(CONFIG_ETH_NATIVE_POSIX) + zephyr_library() + zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/l2) + zephyr_library_compile_definitions(NO_POSIX_CHEATS) + zephyr_library_compile_definitions(_BSD_SOURCE) + zephyr_library_sources( + eth_native_posix.c + eth_native_posix_adapt.c + ) +endif() diff --git a/drivers/ethernet/eth_native_posix_adapt.c b/drivers/ethernet/eth_native_posix_adapt.c index 102f63cd1f1..c66c4e76234 100644 --- a/drivers/ethernet/eth_native_posix_adapt.c +++ b/drivers/ethernet/eth_native_posix_adapt.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include "posix_trace.h"