Skip to content

Commit 96b19af

Browse files
authored
Arm backend: Guard empty cmake arg array in build_executorch (pytorch#19840)
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 <erik.lundell@arm.com>
1 parent 5ca3207 commit 96b19af

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

backends/arm/scripts/build_executorch.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ cmake_args=(
9696
-DEXECUTORCH_BUILD_DEVTOOLS=${build_devtools}
9797
-DEXECUTORCH_BUILD_ARM_ETDUMP=${build_with_etdump}
9898
-DEXECUTORCH_BAREMETAL_SKIP_INSTALL=OFF
99-
"${extra_cmake_args[@]}"
10099
)
101100

101+
if [[ ${#extra_cmake_args[@]} -gt 0 ]]; then
102+
cmake_args+=("${extra_cmake_args[@]}")
103+
fi
104+
102105
if [[ -n "${target_cpu}" ]]; then
103106
cmake_args+=(-DTARGET_CPU=${target_cpu})
104107
fi

0 commit comments

Comments
 (0)