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 <filipe.cavalcanti@espressif.com>
This commit is contained in:
Filipe Cavalcanti
2026-03-25 15:28:21 -03:00
committed by archer
parent 9eb07645ac
commit 709453beca
+23
View File
@@ -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