From eea9508357c76fbbd44b59bebfcb17361389f619 Mon Sep 17 00:00:00 2001 From: Zhaoqi Xu Date: Tue, 8 Sep 2026 08:39:55 +0800 Subject: [PATCH] cmake: reconfigure when .config changes config.h and CONFIG_* are produced at configure time. kconfig-tweak edits .config without going through the menuconfig target, so Ninja left a stale header. Watch .config with CMAKE_CONFIGURE_DEPENDS. Fixes apache/nuttx#12322 Signed-off-by: Zhaoqi Xu --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d058637a92b95..16f2720b99180 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -413,6 +413,15 @@ if(NOT EXISTS ${NUTTX_BINARY_DIR}/.config OR NOT "${NUTTX_DEFCONFIG}" STREQUAL message(STATUS " Appdir: ${NUTTX_APPS_DIR}") endif() +# config.h and CONFIG_* are generated at configure time. Watch .config so an +# out-of-band edit (kconfig-tweak) reruns CMake instead of leaving a stale +# header. .config is only rewritten when missing or the defconfig path changes, +# so this does not loop. +set_property( + DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS ${NUTTX_BINARY_DIR}/.config) + # declare global custom targets at very beginning `nuttx_global` is used to hold # global target properties to solve that cmake GLOBAL property can not use # generator expression this is needed to make sure added before project() create