feat(cmakev2/kconfig): add GENERATE_SDKCONFIG build property

Add a GENERATE_SDKCONFIG build property that controls whether kconfgen
writes the sdkconfig file (--output config) during the configuration
step. It defaults to 1 (enabled).

When building the bootloader as a subproject, the set of components
(and their Kconfig files) differs from the main project. Running
kconfgen with --output config in this context rewrites the main
project's sdkconfig. Even when the content is identical, the timestamp
update causes ninja to detect sdkconfig as newer than build.ninja
outputs (e.g. cmake_install.cmake), triggering an infinite CMake
re-run loop.

Setting GENERATE_SDKCONFIG to 0 in a subproject prevents this,
matching the behaviour of cmakev1's __OUTPUT_SDKCONFIG property.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2026-03-27 19:18:11 +08:00
committed by BOT
parent c91597454d
commit a2461ea32b
+6 -1
View File
@@ -57,6 +57,7 @@ function(__init_kconfig)
idf_build_set_property(SDKCONFIG "${sdkconfig}")
idf_build_set_property(__SDKCONFIG_ORIG "${sdkconfig}")
idf_build_set_property(SDKCONFIG_DEFAULTS "${sdkconfig_defaults_checked}")
idf_build_set_property(GENERATE_SDKCONFIG 1)
# Setup ESP-IDF root Kconfig and sdkconfig.rename files.
idf_build_set_property(__ROOT_KCONFIG "${idf_path}/Kconfig")
@@ -643,9 +644,13 @@ function(__generate_kconfig_outputs)
--output header "${sdkconfig_header}"
--output cmake "${sdkconfig_cmake}"
--output json "${sdkconfig_json}"
--output config "${sdkconfig}"
)
idf_build_get_property(generate_sdkconfig GENERATE_SDKCONFIG)
if(generate_sdkconfig)
list(APPEND kconfgen_outputs_cmd --output config "${sdkconfig}")
endif()
idf_build_set_property(__KCONFGEN_OUTPUTS_CMD "${kconfgen_outputs_cmd}")
# Generate Kconfig outputs using kconfgen