fix(cmakev2/compat): auto-append IDF_TARGET_ARCH to overridden common-requires

When an app sets __COMPONENT_REQUIRES_COMMON before project(), the
explicit value used to bypass the default branch that includes
${idf_target_arch}, dropping the arch component from the build.
IDF_TARGET_ARCH isn't known pre-project(), so apps shouldn't have to
hand-roll a target -> arch map. Append it after the explicit list during
common-component initialization; empty on linux means no append.
This commit is contained in:
Sudeep Mohanty
2026-06-29 22:10:21 +08:00
committed by BOT
parent 201b2c61ed
commit 7d8b791fff
+8
View File
@@ -425,6 +425,14 @@ function(__init_common_components)
# component.
if(explicit_requires_common)
set(requires_common "${explicit_requires_common}")
# Auto-append the target's arch component when the app overrides
# common-requires without it. Lets G0-style apps (which set the property
# before project() to a restricted list) avoid hand-rolling a
# target -> arch map pre-project, since IDF_TARGET_ARCH isn't known
# until after sdkconfig is included. Empty on linux -> no append.
if(idf_target_arch AND NOT idf_target_arch IN_LIST requires_common)
list(APPEND requires_common "${idf_target_arch}")
endif()
elseif("${idf_target}" STREQUAL "linux")
set(requires_common freertos esp_hw_support heap log soc hal esp_rom esp_common esp_system linux