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 <toku@mac.com>
This commit is contained in:
Shoji Tokunaga 2026-05-17 14:07:13 +09:00 committed by Lup Yuen Lee
parent ecfc1b5b61
commit e536adaabc

View file

@ -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)