From edf8f4b68948b316a4309da3086701a557a21ee2 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 19 Aug 2025 18:49:57 +0200 Subject: [PATCH] fix(esp_eth/cmake): avoid using BUILD_COMPONENTS build property for IDF_BUILD_V2 IDF_BUILD_V2 does not have BUILD_COMPONENTS build property. Therefore, when IDF_BUILD_V2 is defined, use a generator expressions instead. The inclusion of esp_eth_netif_glue.c, which relies on the presence of the esp_netif component, should ideally be managed by a configuration option. The same applies to the requirements for esp_eth. Currently, only a basic adjustment has been made to enable the inclusion of esp_eth in cmakev2. Signed-off-by: Frantisek Hrbata --- components/esp_eth/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/esp_eth/CMakeLists.txt b/components/esp_eth/CMakeLists.txt index 0875def6f1e..c31497d42e4 100644 --- a/components/esp_eth/CMakeLists.txt +++ b/components/esp_eth/CMakeLists.txt @@ -4,8 +4,6 @@ if(${target} STREQUAL "linux") return() # This component is not supported by the POSIX/Linux simulator endif() -idf_build_get_property(components_to_build BUILD_COMPONENTS) - set(srcs) set(include) set(ld_fragments linker.lf) @@ -19,8 +17,9 @@ if(CONFIG_ETH_ENABLED) set(srcs "src/esp_eth.c" "src/phy/esp_eth_phy_802_3.c") set(include "include") - if(NOT CMAKE_BUILD_EARLY_EXPANSION) + if(NOT CMAKE_BUILD_EARLY_EXPANSION AND NOT IDF_BUILD_V2) # esp_netif related + idf_build_get_property(components_to_build BUILD_COMPONENTS) if(esp_netif IN_LIST components_to_build) list(APPEND srcs "src/esp_eth_netif_glue.c") endif() @@ -46,6 +45,9 @@ idf_component_register(SRCS "${srcs}" PRIV_REQUIRES ${priv_requires}) if(CONFIG_ETH_ENABLED) + if(IDF_BUILD_V2) + target_sources(${COMPONENT_TARGET} PRIVATE "$<$:src/esp_eth_netif_glue.c>") + endif() if(CONFIG_ETH_USE_SPI_ETHERNET) idf_component_optional_requires(PUBLIC esp_driver_spi) endif()