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

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

commit 709453beca070df5f5707dd9272939975c5f22db
Author: Filipe Cavalcanti <[email protected]>
AuthorDate: Wed Mar 25 15:28:21 2026 -0300

    cmake: add olddefconfig target for CMake builds
    
    Olddefconfig allows refreshing .config options if the user manually
    edit some entry on .config file.
    
    Signed-off-by: Filipe Cavalcanti <[email protected]>
---
 cmake/menuconfig.cmake | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/cmake/menuconfig.cmake b/cmake/menuconfig.cmake
index 22093f57da1..bf515c14db3 100644
--- a/cmake/menuconfig.cmake
+++ b/cmake/menuconfig.cmake
@@ -59,6 +59,17 @@ add_custom_target(
   WORKING_DIRECTORY ${NUTTX_DIR}
   USES_TERMINAL)
 
+# Refresh ${CMAKE_BINARY_DIR}/.config in place (set defaults, satisfy deps),
+# like "make olddefconfig". Use after hand-editing .config; does not copy from
+# board defconfig (see resetconfig for that).
+add_custom_target(
+  olddefconfig
+  COMMAND ${CMAKE_COMMAND} -E env ${KCONFIG_ENV} olddefconfig
+  COMMAND ${CMAKE_COMMAND} -E remove -f
+          ${CMAKE_BINARY_DIR}/include/nuttx/config.h
+  COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_PARENT_LIST_FILE}
+  WORKING_DIRECTORY ${NUTTX_DIR})
+
 # utility target to restore .config from board's defconfig
 add_custom_target(
   resetconfig
@@ -70,6 +81,18 @@ add_custom_target(
   COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_PARENT_LIST_FILE}
   WORKING_DIRECTORY ${NUTTX_DIR})
 
+# utility target to remove .config (and related) so next configure regenerates
+# from the current BOARD_CONFIG defconfig. Use when switching defconfigs after
+# "clean" so that the next "cmake -B build -DBOARD_CONFIG=board:newconfig"
+# recreates .config from the new defconfig.
+add_custom_target(
+  distcleanconfig
+  COMMAND
+    ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/.config
+    ${CMAKE_BINARY_DIR}/.config.orig ${CMAKE_BINARY_DIR}/.config.prev
+    ${CMAKE_BINARY_DIR}/include/nuttx/config.h
+  WORKING_DIRECTORY ${NUTTX_DIR})
+
 # utility target to refresh .config from board's defconfig for GITHUB
 add_custom_target(
   refreshsilent

Reply via email to