cmake:fix invalid configs when export defconfig and .config

when func `nuttx_export_kconfig` is called for the second time,
the expired configuration will be retained causing compilation failure

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19
2023-08-28 11:21:55 +08:00
committed by Xiang Xiao
parent 221ae1f1d1
commit 94e6cfb662

View File

@@ -35,6 +35,11 @@ function(nuttx_export_kconfig_by_value kconfigfile config)
endfunction()
function(nuttx_export_kconfig kconfigfile)
# First delete the expired configuration items
get_property(expired_keys GLOBAL PROPERTY NUTTX_CONFIG_KEYS)
foreach(key ${expired_keys})
set(${key} PARENT_SCOPE)
endforeach()
file(STRINGS ${kconfigfile} ConfigContents)
foreach(NameAndValue ${ConfigContents})
# Strip leading spaces
@@ -54,6 +59,7 @@ function(nuttx_export_kconfig kconfigfile)
set(${Name}
${Value}
PARENT_SCOPE)
set_property(GLOBAL APPEND PROPERTY NUTTX_CONFIG_KEYS ${Name})
endif()
endforeach()