From ee343bb26a6599820ad56af9def10b35bb2af7d2 Mon Sep 17 00:00:00 2001 From: Erik Lundell Date: Thu, 28 May 2026 10:26:37 +0200 Subject: [PATCH] Arm backend: Guard empty cmake arg array in build_executorch Avoid expanding extra_cmake_args when the array is empty. Older Bash versions on macOS treat an empty array expansion under set -u as an unbound variable. Append the extra CMake arguments only when the array is non-empty so the script behaves the same on Linux and macOS. Signed-off-by: Erik Lundell Change-Id: Icff94493ee683bfd3005fc503083207307fcf48c --- backends/arm/scripts/build_executorch.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/arm/scripts/build_executorch.sh b/backends/arm/scripts/build_executorch.sh index 5ac2674f964..5ebc0eb46b4 100755 --- a/backends/arm/scripts/build_executorch.sh +++ b/backends/arm/scripts/build_executorch.sh @@ -96,9 +96,12 @@ cmake_args=( -DEXECUTORCH_BUILD_DEVTOOLS=${build_devtools} -DEXECUTORCH_BUILD_ARM_ETDUMP=${build_with_etdump} -DEXECUTORCH_BAREMETAL_SKIP_INSTALL=OFF - "${extra_cmake_args[@]}" ) +if [[ ${#extra_cmake_args[@]} -gt 0 ]]; then + cmake_args+=("${extra_cmake_args[@]}") +fi + if [[ -n "${target_cpu}" ]]; then cmake_args+=(-DTARGET_CPU=${target_cpu}) fi