Commit Graph

4 Commits

Author SHA1 Message Date
Junbo Zheng
2578638d52 cmake: correct nuttx_wildcard_sources cmake usage
reference:
https://cmake.org/cmake/help/latest/command/cmake_parse_arguments.html

add debug message for test
```diff
diff --git a/cmake/nuttx_extensions.cmake b/cmake/nuttx_extensions.cmake
index 9ed430b74a..baa22cf90d 100644

--- a/cmake/nuttx_extensions.cmake
+++ b/cmake/nuttx_extensions.cmake
@@ -116,6 +116,9 @@ endfunction()
 function(nuttx_wildcard_sources)
   cmake_parse_arguments(ARGS "" "" EXCLUDE ${ARGN})

+  message(STATUS "## UNPARSED ARGUMENTS ${ARGS_UNPARSED_ARGUMENTS}")
+  message(STATUS "## ARGN ${ARGN}")
+
   file(GLOB SRCS ${ARGS_UNPARSED_ARGUMENTS})
   if(ARGS_EXCLUDE)
     file(GLOB RM_SRCS ${ARGS_EXCLUDE})
```

cmake build test
```
➜  /home/mi/local/mycpp [25-10-15_14:11:41] git:(master) ✗ ls demo
1.c  2.c  3.c
➜  /home/mi/local/mycpp [25-10-15_14:11:57] git:(master) ✗ cmake -S . -B build -G Ninja
>> 14:12:42.161053 INFO    [demo] Time taken: 0ms
-- ## UNPARSED ARGUMENTS aaa/*.c
-- ## ARGN aaa/*.c;EXCLUDE;aaa/3.c
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mi/local/mycpp/build
➜  /home/mi/local/mycpp [25-10-15_14:12:47] git:(master) ✗
```

`SRCS` just collect all source files instead of EXCLUDE arguments

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2025-10-16 12:48:40 +08:00
Junbo Zheng
a88eb1fc6b cmake: enhance the function of cmake nuttx_wildcard_sources
align already used cmake ifdef/ifndef nuttx_xxx functions, reference:
- https://github.com/apache/nuttx/pull/14747

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2025-07-14 20:41:12 +08:00
xuxin19
cfe78ad74e cmake(enhance):enhance NuttX cmake target dependencies and link_library modules
Enhance CMake's add_dependencies for Nuttx so that
different targets can call dependencies without errors when they are not traversed.

In addition, since we do not call link_library directly,
we increment nuttx_link_library to inherit the PUBLIC property

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-22 15:16:07 -03:00
xuxin19
4f895b3300 cmake(enhance):add NuttX CMake extensions module
Wrapped CMake native method is nuttx_cmake module
It can be quickly called in the build system

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-12 15:30:21 -03:00