From 92987708ecb470bbb41f20306cf5fac5c46394e5 Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Sun, 4 Feb 2024 21:42:05 +0800 Subject: [PATCH] cmake:adapt BOARD_CONFIG absolute paths and relative paths when reconfig Define `NUTTX_DEFCONFIG` and `NUTTX_BOARD_ABS_DIR` instead of `BOARD_CONFIG` when reconfiguring a custom configuration, because ${BOARD_CONFIG} uses a relative path, it will cause the following error: CMake Error at CMakeLists.txt:134 (message) No config file found at Signed-off-by: xuxin19 --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e2be1a85c..fce86072c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,12 @@ if(NOT KCONFIGLIB) $ pip install kconfiglib") endif() -if(EXISTS ${BOARD_CONFIG} AND EXISTS ${BOARD_CONFIG}/defconfig) +# BOARD CONFIG can be set to directory path, or [/:] +# configuration pair + +if((EXISTS ${BOARD_CONFIG} AND EXISTS ${BOARD_CONFIG}/defconfig) + OR (EXISTS ${NUTTX_DIR}/${BOARD_CONFIG} + AND EXISTS ${NUTTX_DIR}/${BOARD_CONFIG}/defconfig)) get_filename_component(NUTTX_BOARD_ABS_DIR ${BOARD_CONFIG} ABSOLUTE BASE_DIR ${NUTTX_DIR}) @@ -103,7 +108,7 @@ if(EXISTS ${BOARD_CONFIG} AND EXISTS ${BOARD_CONFIG}/defconfig) string(REGEX REPLACE "(.*)/(.*)/${NUTTX_CONFIG}" "\\1" NUTTX_BOARD_DIR ${NUTTX_BOARD_ABS_DIR}) - set(NUTTX_DEFCONFIG ${BOARD_CONFIG}/defconfig) + set(NUTTX_DEFCONFIG ${NUTTX_BOARD_ABS_DIR}/defconfig) else() if(BOARD_CONFIG MATCHES "/") set(MATCH_REGEX "/")