I’m running cmake 3.20.2 on Windows 10 and trying to use find_program to find arm-none-eabi-gcc.exe:
# Find the path of arm-none-eabi-gcc.exe
set (SUFFIX .exe)
set(CMAKE_FIND_DEBUG_MODE TRUE)
find_program(CROSS_GCC_PATH arm-none-eabi-gcc${SUFFIX}
HINTS "/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin"
#HINTS $ENV{GNU_ARM_TOOLCHAIN_PATH}
REQUIRED)
set(CMAKE_FIND_DEBUG_MODE FALSE)
Env variable GNU_ARM_TOOLCHAIN_PATH is set as follows:
>set GNU_ARM_TOOLCHAIN_PATH
GNU_ARM_TOOLCHAIN_PATH="/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin"
With the code as shown, the compiler is found:
find_program considered the following locations:
/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe.com
The item was found at
/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin/arm-none-eabi-gcc.exe
But if I attempt to use the env variable:
# Find the path of arm-none-eabi-gcc.exe
set (SUFFIX .exe)
set(CMAKE_FIND_DEBUG_MODE TRUE)
find_program(CROSS_GCC_PATH arm-none-eabi-gcc${SUFFIX}
#HINTS "/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin"
HINTS $ENV{GNU_ARM_TOOLCHAIN_PATH}
REQUIRED)
set(CMAKE_FIND_DEBUG_MODE FALSE)
Find fails:
find_program considered the following locations:
C:/SVNProj/Elysion/trunk/software/prototypes/wdt_interrupt_gnu/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin"/arm-none-eabi-gcc.exe.com
C:/SVNProj/Elysion/trunk/software/prototypes/wdt_interrupt_gnu/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/bin"/arm-none-eabi-gcc.exe
<snip>
It seems that if I use ENV my hint is appended to the current working directory, instead of being used as a root path.
How can I fix this please?