mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
fix(cmakev2): mirror sdkconfig CONFIG_* onto build properties
Read sdkconfig.cmake's CONFIG_* values and re-publish them on the build-properties target so component CMakeLists.txt code that queries Kconfig via idf_build_get_property(var CONFIG_FOO) returns the expected value.
This commit is contained in:
@@ -922,3 +922,27 @@ function(idf_build_component component_dir)
|
||||
PREFIX "${component_prefix}"
|
||||
SOURCE "${component_source}")
|
||||
endfunction()
|
||||
|
||||
#[[
|
||||
__import_sdkconfig_as_build_properties()
|
||||
|
||||
Mirror every CONFIG_* symbol from the generated sdkconfig.cmake onto the
|
||||
build-properties target so that the
|
||||
`idf_build_get_property(var CONFIG_FOO)` idiom keeps working under the
|
||||
compatibility shim. Called from kconfig.cmake::__generate_sdkconfig after
|
||||
each kconfgen run.
|
||||
#]]
|
||||
function(__import_sdkconfig_as_build_properties)
|
||||
idf_build_get_property(sdkconfig_cmake __SDKCONFIG_CMAKE)
|
||||
if(NOT sdkconfig_cmake OR NOT EXISTS "${sdkconfig_cmake}")
|
||||
return()
|
||||
endif()
|
||||
include("${sdkconfig_cmake}")
|
||||
if(NOT DEFINED CONFIGS_LIST)
|
||||
return()
|
||||
endif()
|
||||
idf_build_set_property(__CONFIG_VARIABLES "${CONFIGS_LIST}")
|
||||
foreach(config IN LISTS CONFIGS_LIST)
|
||||
idf_build_set_property("${config}" "${${config}}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
@@ -208,6 +208,10 @@ function(__generate_sdkconfig)
|
||||
# Generate Kconfig outputs
|
||||
__generate_kconfig_outputs()
|
||||
|
||||
# Mirror CONFIG_* values onto build properties so
|
||||
# `idf_build_get_property(var CONFIG_FOO)` keeps working.
|
||||
__import_sdkconfig_as_build_properties()
|
||||
|
||||
idf_msg("Generated sdkconfig configuration")
|
||||
endfunction()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user