This is an automated email from the ASF dual-hosted git repository.

lupyuen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new e536adaab apps/cmake: Add DEPENDS for Rust-related files.
e536adaab is described below

commit e536adaabc92f77ad652a4b1f45986d7ebceb75c
Author: Shoji Tokunaga <[email protected]>
AuthorDate: Sun May 17 14:07:13 2026 +0900

    apps/cmake: Add DEPENDS for Rust-related files.
    
    * Add `DEPENDS` to ensure staticlib rebuilds when Rust-related files change.
    * Uses `GLOB_RECURSE` to search for Rust-related files.
    
    Signed-off-by: Shoji Tokunaga <[email protected]>
---
 cmake/nuttx_add_rust.cmake | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/cmake/nuttx_add_rust.cmake b/cmake/nuttx_add_rust.cmake
index 55fce1a8e..c8546f0fa 100644
--- a/cmake/nuttx_add_rust.cmake
+++ b/cmake/nuttx_add_rust.cmake
@@ -168,6 +168,18 @@ function(nuttx_add_rust)
   # Create build directory
   file(MAKE_DIRECTORY ${RUST_BUILD_DIR})
 
+  # Collect Rust source files and manifests as dependencies so that changes in
+  # the crate trigger a rebuild via CMake/Ninja.
+  file(
+    GLOB_RECURSE
+    RUST_CRATE_SOURCES
+    CONFIGURE_DEPENDS
+    "${CRATE_PATH}/Cargo.toml"
+    "${CRATE_PATH}/Cargo.lock"
+    "${CRATE_PATH}/build.rs"
+    "${CRATE_PATH}/src/*.rs"
+    "${CRATE_PATH}/src/**/*.rs")
+
   # Add a custom command to build the Rust crate
   add_custom_command(
     OUTPUT ${RUST_LIB_PATH}
@@ -178,6 +190,7 @@ function(nuttx_add_rust)
       -Zbuild-std=std,panic_abort -Zjson-target-spec --manifest-path
       ${CRATE_PATH}/Cargo.toml --target ${RUST_TARGET} --target-dir
       ${RUST_BUILD_DIR}
+    DEPENDS ${RUST_CRATE_SOURCES}
     COMMENT "Building Rust crate ${CRATE_NAME}"
     VERBATIM)
 

Reply via email to