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()