From 94e6cfb662b192b39e7e993081377a0ae1486ae2 Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Mon, 28 Aug 2023 11:21:55 +0800 Subject: [PATCH] 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 --- cmake/nuttx_kconfig.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/nuttx_kconfig.cmake b/cmake/nuttx_kconfig.cmake index 7858f379c9..2b19a1cd74 100644 --- a/cmake/nuttx_kconfig.cmake +++ b/cmake/nuttx_kconfig.cmake @@ -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()