1# SPDX-License-Identifier: Apache-2.0 2 3# Configures binary tools as llvm binary tool set 4 5if(DEFINED TOOLCHAIN_HOME) 6 set(find_program_clang_args PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH) 7 set(find_program_binutils_args PATHS ${TOOLCHAIN_HOME}) 8endif() 9 10# Extract the clang version. Debian (maybe other distros?) will 11# append a version to llvm-objdump/objcopy 12execute_process(COMMAND ${CMAKE_C_COMPILER} --version 13 OUTPUT_VARIABLE CLANGVER) 14string(REGEX REPLACE "[^0-9]*([0-9]+).*" "\\1" CLANGVER ${CLANGVER}) 15 16find_program(CMAKE_AR llvm-ar ${find_program_clang_args}) 17find_program(CMAKE_NM llvm-nm ${find_program_clang_args}) 18find_program(CMAKE_OBJDUMP NAMES 19 llvm-objdump 20 llvm-objdump-${CLANGVER} 21 ${find_program_clang_args}) 22find_program(CMAKE_RANLIB llvm-ranlib ${find_program_clang_args}) 23find_program(CMAKE_STRIP llvm-strip ${find_program_clang_args}) 24find_program(CMAKE_OBJCOPY NAMES 25 llvm-objcopy 26 llvm-objcopy-${CLANGVER} 27 objcopy 28 ${find_program_binutils_args}) 29find_program(CMAKE_READELF NAMES 30 llvm-readelf 31 llvm-readelf-${CLANGVER} 32 readelf 33 ${find_program_binutils_args}) 34 35# Use the gnu binutil abstraction 36include(${ZEPHYR_BASE}/cmake/bintools/llvm/target_bintools.cmake) 37