Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
I noticed an inconsistency in how component properties are accessed throughout the ESP-IDF CMake build system. The codebase has a wrapper function __component_get_property
for accessing component properties, but in some places the code bypasses this wrapper and calls get_property
directly.
In the __build_expand_requirements
function in esp-idf/tools/cmake/build.cmake
, the code directly uses get_property
:
get_property(reqs TARGET ${component_target} PROPERTY REQUIRES)
get_property(priv_reqs TARGET ${component_target} PROPERTY PRIV_REQUIRES)
But in the same function, other properties are accessed using the wrapper function:
__component_get_property(component_name ${component_target} COMPONENT_NAME)
__component_get_property(component_alias ${component_target} COMPONENT_ALIAS)
The __component_get_property
function is simply a thin wrapper around get_property
:
function(__component_get_property var component_target property)
get_property(val TARGET ${component_target} PROPERTY ${property})
set(${var} "${val}" PARENT_SCOPE)
endfunction()
While this doesn't cause functional issues, I'm curious about the reasoning behind this mixed approach. Is this pattern the result of historical development where different approaches were used at different times, or is there a deliberate design decision I'm missing?