From 7d8b791fff76f6897803650babf86d54b2555722 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 18 May 2026 13:41:01 +0200 Subject: [PATCH] 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. --- tools/cmakev2/compat.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/cmakev2/compat.cmake b/tools/cmakev2/compat.cmake index 8b3e80f6638..c6100ab9dfb 100644 --- a/tools/cmakev2/compat.cmake +++ b/tools/cmakev2/compat.cmake @@ -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