From 1b40b10dc1df98a7c03e4db707b981ed66d56e6c Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Mon, 18 Aug 2025 16:22:59 +0200 Subject: [PATCH] fix(heap/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. I believe that the one-liner should also work with IDF_BUILD_V1, but the change is kept separate to clearly show the difference between IDF_BUILD_V1 and IDF_BUILD_V2. Signed-off-by: Frantisek Hrbata --- components/heap/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/heap/CMakeLists.txt b/components/heap/CMakeLists.txt index 8fa40265ed..af11108766 100644 --- a/components/heap/CMakeLists.txt +++ b/components/heap/CMakeLists.txt @@ -69,9 +69,13 @@ if(CONFIG_HEAP_TRACING) endforeach() endif() -if(NOT CMAKE_BUILD_EARLY_EXPANSION) - idf_build_get_property(build_components BUILD_COMPONENTS) - if(freertos IN_LIST build_components) - target_compile_options(${COMPONENT_TARGET} PRIVATE "-DMULTI_HEAP_FREERTOS") +if(IDF_BUILD_V2) + target_compile_options(${COMPONENT_TARGET} PRIVATE "$<$:-DMULTI_HEAP_FREERTOS>") +else() + if(NOT CMAKE_BUILD_EARLY_EXPANSION) + idf_build_get_property(build_components BUILD_COMPONENTS) + if(freertos IN_LIST build_components) + target_compile_options(${COMPONENT_TARGET} PRIVATE "-DMULTI_HEAP_FREERTOS") + endif() endif() endif()