diff --git a/scripts/cmake/xtensa-toolchain.cmake b/scripts/cmake/xtensa-toolchain.cmake index 48cbd3830..a79fba042 100644 --- a/scripts/cmake/xtensa-toolchain.cmake +++ b/scripts/cmake/xtensa-toolchain.cmake @@ -36,10 +36,10 @@ else() set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc) endif() -set(CMAKE_LD ${CROSS_COMPILE}ld CACHE STRING "") -set(CMAKE_AR ${CROSS_COMPILE}ar CACHE STRING "") -set(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy) -set(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump) +find_program(CMAKE_LD NAMES "${CROSS_COMPILE}ld" PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_AR NAMES "${CROSS_COMPILE}ar" PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_OBJCOPY NAMES "${CROSS_COMPILE}objcopy" PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_OBJDUMP NAMES "${CROSS_COMPILE}objdump" PATHS ENV PATH NO_DEFAULT_PATH) set(CMAKE_FIND_ROOT_PATH ".") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/test/cmocka/cmocka-xtensa-xt-toolchain.cmake b/test/cmocka/cmocka-xtensa-xt-toolchain.cmake index 5571d8fba..81e869aa9 100644 --- a/test/cmocka/cmocka-xtensa-xt-toolchain.cmake +++ b/test/cmocka/cmocka-xtensa-xt-toolchain.cmake @@ -15,10 +15,10 @@ set(CROSS_COMPILE "xt-") set(CMAKE_C_COMPILER ${CROSS_COMPILE}xcc) -set(CMAKE_LD ${CROSS_COMPILE}ld CACHE STRING "") -set(CMAKE_AR ${CROSS_COMPILE}ar CACHE STRING "") -set(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy) -set(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump) +find_program(CMAKE_LD NAMES "${CROSS_COMPILE}ld" PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_AR NAMES "${CROSS_COMPILE}ar" PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_OBJCOPY NAMES "${CROSS_COMPILE}objcopy" PATHS ENV PATH NO_DEFAULT_PATH) +find_program(CMAKE_OBJDUMP NAMES "${CROSS_COMPILE}objdump" PATHS ENV PATH NO_DEFAULT_PATH) set(CMAKE_FIND_ROOT_PATH ".") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)