From 2f98314952bab9e44f2bdcb5c5a6a4d7777c337f Mon Sep 17 00:00:00 2001 From: Raoul Wols Date: Thu, 15 May 2025 10:20:39 +0200 Subject: [PATCH] INS-14641 Allow setting the toolchain prefix for cross-compilation This allows build hosts like macOS to use a cross-compiler sitting in ~/Downloads to cross-compile pinata sources. For example, if you have an ARM cross compiler downloaded in ~/Downloads/arm-gnu-toolchain-13.3.rel1-darwin-arm64-arm-none-eabi You should configure cmake with cmake -DPREFIX=~/Downloads/arm-gnu-toolchain-13.3.rel1-darwin-arm64-arm-none-eabi/bin/arm-none-eabi- -DCMAKE_TOOLCHAIN_FILE=./gcc-arm-none-eabi.toolchain.cmake .. --- gcc-arm-none-eabi.toolchain.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc-arm-none-eabi.toolchain.cmake b/gcc-arm-none-eabi.toolchain.cmake index 40e9b31..6498fb3 100644 --- a/gcc-arm-none-eabi.toolchain.cmake +++ b/gcc-arm-none-eabi.toolchain.cmake @@ -1,5 +1,8 @@ # Toolchain for gcc-arm-none-eabi -set(PREFIX /usr/bin/arm-none-eabi-) +if(NOT DEFINED PREFIX) + message(STATUS "PREFIX variable is not defined. Assuming \"/usr/bin/arm-none-eabi-\"") + set(PREFIX /usr/bin/arm-none-eabi-) +endif() set(CMAKE_C_COMPILER ${PREFIX}gcc) set(CMAKE_CXX_COMPILER ${PREFIX}g++) set(CMAKE_ASM_COMPILER ${PREFIX}gcc)