This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 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 29c083eb8ed fs/littlefs: pass LFS_CONFIG and LFS_DEFINES as relative
paths
29c083eb8ed is described below
commit 29c083eb8ed73ff0aadeffbd878db4bded7e4639
Author: zhaoxingyu1 <[email protected]>
AuthorDate: Wed Apr 16 17:53:51 2025 +0800
fs/littlefs: pass LFS_CONFIG and LFS_DEFINES as relative paths
The CMake build derived these headers from CMAKE_CURRENT_LIST_DIR, so
the absolute path of the source tree was baked into the build
directory. A configured build tree then stops working as soon as the
sources are moved, renamed or copied: the compiler keeps looking for the
header under the old location and fails in
#include LFS_STRINGIZE(LFS_CONFIG)
Pass the paths relative to the including file instead, which is what
Make.defs already does. lfs_util.h lives in fs/littlefs/littlefs, so
"../lfs_vfs.h" resolves to fs/littlefs/lfs_vfs.h no matter where the
tree sits or which directory the compiler runs in.
Signed-off-by: zhaoxingyu1 <[email protected]>
---
fs/littlefs/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/littlefs/CMakeLists.txt b/fs/littlefs/CMakeLists.txt
index 5b236d96f15..9cac37ea337 100644
--- a/fs/littlefs/CMakeLists.txt
+++ b/fs/littlefs/CMakeLists.txt
@@ -57,8 +57,8 @@ if(CONFIG_FS_LITTLEFS)
$<$<NOT:$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>>:-DLFS_WARN=fwarn>
$<$<NOT:$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>>:-DLFS_ERROR=ferr>
$<$<NOT:$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>>:-DLFS_ASSERT=DEBUGASSERT>
-
$<$<NOT:$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>>:-DLFS_CONFIG=${CMAKE_CURRENT_LIST_DIR}/lfs_vfs.h>
-
$<$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>:-DLFS_DEFINES=${CMAKE_CURRENT_LIST_DIR}/lfs_nuttx_defines.h>
+
$<$<NOT:$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>>:-DLFS_CONFIG=../lfs_vfs.h>
+
$<$<BOOL:${CONFIG_FS_LITTLEFS_HAS_LFS_DEFINES}>:-DLFS_DEFINES=../lfs_nuttx_defines.h>
-DLFS_NAME_MAX=${CONFIG_FS_LITTLEFS_NAME_MAX}
-DLFS_FILE_MAX=${CONFIG_FS_LITTLEFS_FILE_MAX}
-DLFS_ATTR_MAX=${CONFIG_FS_LITTLEFS_ATTR_MAX}