This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 94e6cfb662 cmake:fix invalid configs when export defconfig and .config
94e6cfb662 is described below

commit 94e6cfb662b192b39e7e993081377a0ae1486ae2
Author: xuxin19 <[email protected]>
AuthorDate: Mon Aug 28 11:21:55 2023 +0800

    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 <[email protected]>
---
 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()
 

Reply via email to