fix(test_apps/g0_components): skip -D injection when Kconfig is processed

The CMakeLists injects CONFIG_ESP_REV_MIN_FULL and CONFIG_XTAL_FREQ on
the command line because those symbols live in esp_common's Kconfig,
which is outside the G0 closure and is not loaded during a restricted
COMPONENTS build. When every discovered component's Kconfig is processed
(IDF_BUILD_V2) the symbols are already defined via their Kconfig
defaults, and the additional -D would conflict with the existing
definition.

Gate the injection so it only runs when the Kconfig is not processed.
This commit is contained in:
Sudeep Mohanty
2026-05-21 13:58:27 +02:00
parent f6a7775dc8
commit 6084733b91
@@ -36,13 +36,21 @@ idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH_ENABLED 1)
project(g0_components)
if(CONFIG_IDF_TARGET_ESP32P4)
idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_ESP_REV_MIN_FULL=300" APPEND)
endif()
# CONFIG_ESP_REV_MIN_FULL and CONFIG_XTAL_FREQ live in esp_common's Kconfig,
# which is outside the G0 closure. When that Kconfig is not loaded the
# symbols are absent from sdkconfig.h and the G0 sources need them on the
# command line. When every component's Kconfig is processed (IDF_BUILD_V2)
# the symbols are already defined via their Kconfig defaults; injecting
# them again would conflict, so skip the injection.
if(NOT IDF_BUILD_V2)
if(CONFIG_IDF_TARGET_ESP32P4)
idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_ESP_REV_MIN_FULL=300" APPEND)
endif()
if(CONFIG_IDF_TARGET_ESP32C2)
# clk_tree hal-driver needs CONFIG_XTAL_FREQ
idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_XTAL_FREQ=26" APPEND)
if(CONFIG_IDF_TARGET_ESP32C2)
# clk_tree hal-driver needs CONFIG_XTAL_FREQ
idf_build_set_property(C_COMPILE_OPTIONS "-DCONFIG_XTAL_FREQ=26" APPEND)
endif()
endif()
# Currently, only support a single core on Xtensa targets.