!4452 used setting LINK_LIBRARIES and INTERFACE_LINK_LIBRARIES to link components built under ESP-IDF build system. However, LINK_LIBRARIES does not produce behavior same as linking PRIVATE. This MR uses the new signature for target_link_libraries directly instead. This also moves setting dependencies during component registration rather than after all components have been processed. The consequence is that internally, components have to use the new signature form as well. This does not affect linking the components to external targets, such as with idf_as_lib example. This only affects linking additional libraries to ESP-IDF libraries outside component processing (after idf_build_process), which is not even possible for CMake<v3.13 as target_link_libraries is not valid for targets not created in current directory. See https://cmake.org/cmake/help/v3.13/policy/CMP0079.html#policy:CMP0079
38 lines
931 B
CMake
38 lines
931 B
CMake
set(COMPONENT_SRCS "heap_caps.c"
|
|
"heap_caps_init.c"
|
|
"multi_heap.c")
|
|
|
|
if(NOT CONFIG_HEAP_POISONING_DISABLED)
|
|
list(APPEND COMPONENT_SRCS "multi_heap_poisoning.c")
|
|
endif()
|
|
|
|
if(CONFIG_HEAP_TASK_TRACKING)
|
|
list(APPEND COMPONENT_SRCS "heap_task_info.c")
|
|
endif()
|
|
|
|
if(CONFIG_HEAP_TRACING_STANDALONE)
|
|
list(APPEND COMPONENT_SRCS "heap_trace_standalone.c")
|
|
endif()
|
|
|
|
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
|
set(COMPONENT_ADD_LDFRAGMENTS linker.lf)
|
|
set(COMPONENT_PRIV_REQUIRES soc)
|
|
register_component()
|
|
|
|
if(CONFIG_HEAP_TRACING)
|
|
set(WRAP_FUNCTIONS
|
|
calloc
|
|
malloc
|
|
free
|
|
realloc
|
|
heap_caps_malloc
|
|
heap_caps_free
|
|
heap_caps_realloc
|
|
heap_caps_malloc_default
|
|
heap_caps_realloc_default)
|
|
|
|
foreach(wrap ${WRAP_FUNCTIONS})
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}")
|
|
endforeach()
|
|
|
|
endif()
|