This is an automated email from the ASF dual-hosted git repository.
acassis 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 c34ffce982b cmake/nuttx_add_application: Keep the UID, GID and MODE of
an application.
c34ffce982b is described below
commit c34ffce982be06db14697f04f405f7a152c7ef27
Author: Marco Casaroli <[email protected]>
AuthorDate: Sun Nov 8 22:16:12 2026 +0100
cmake/nuttx_add_application: Keep the UID, GID and MODE of an application.
nuttx_add_application() takes UID, GID and MODE, but uses them only for the
symbols of a loadable ELF. For a builtin application they were lost, so the
builtin list of apps cannot give the builtin its file owner and mode, as the
make build does from UID, GID and MODE in the Makefile.
Store them as the target properties APP_UID, APP_GID and APP_MODE, next to
APP_PRIORITY and APP_STACK.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
cmake/nuttx_add_application.cmake | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/cmake/nuttx_add_application.cmake
b/cmake/nuttx_add_application.cmake
index f6a7e3b5842..5d6d67dc154 100644
--- a/cmake/nuttx_add_application.cmake
+++ b/cmake/nuttx_add_application.cmake
@@ -67,6 +67,9 @@ endif()
# NO_MAIN_ALIAS : do not add a main=<app>_main alias(*)
# DYNLIB : if "y", build as dynamic loadable library
# LINK_FLAGS : link flags only for elf or loadable link
+# UID : file owner user ID (CONFIG_SCHED_USER_IDENTITY)
+# GID : file owner group ID (CONFIG_SCHED_USER_IDENTITY)
+# MODE : file mode (CONFIG_SCHED_USER_IDENTITY)
#
# (*) This is only really needed in convoluted cases where a single .c file
# contains differently named <app>_main() entries for different <app>. This
@@ -323,6 +326,21 @@ function(nuttx_add_application)
${CONFIG_DEFAULT_TASK_STACKSIZE})
endif()
+ # The builtin list of apps gives the file owner and mode of the application
+ # from these, and 0, 0 and 0555 without them.
+
+ if(UID)
+ set_target_properties(${TARGET} PROPERTIES APP_UID ${UID})
+ endif()
+
+ if(GID)
+ set_target_properties(${TARGET} PROPERTIES APP_GID ${GID})
+ endif()
+
+ if(MODE)
+ set_target_properties(${TARGET} PROPERTIES APP_MODE ${MODE})
+ endif()
+
# call target_ options only target is compilable
if(NOT NO_COMPILABLE_TARGET)
# compile options