cmake: toolchain: clang: Use 'find_program' and TOOLCHAIN_HOME
Align 'clang' with 'gcc' by having it also use 'find_program' instead of 'set' to assign toolchain paths. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
parent
ab2139a90f
commit
ef5cdbb390
2 changed files with 11 additions and 9 deletions
|
@ -9,15 +9,15 @@ if(NOT DEFINED NOSYSDEF_CFLAG)
|
|||
set(NOSYSDEF_CFLAG -undef)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER ${CLANG_ROOT}/bin/clang)
|
||||
set(CMAKE_CXX_COMPILER ${CLANG_ROOT}/bin/clang++)
|
||||
set(CMAKE_AR ${CLANG_ROOT}/bin/llvm-ar CACHE INTERNAL " " FORCE)
|
||||
set(CMAKE_LINKER ${CLANG_ROOT}/bin/llvm-link CACHE INTERNAL " " FORCE)
|
||||
set(CMAKE_NM ${CLANG_ROOT}/bin/llvm-nm CACHE INTERNAL " " FORCE)
|
||||
set(CMAKE_OBJDUMP ${CLANG_ROOT}/bin/llvm-objdump CACHE INTERNAL " " FORCE)
|
||||
set(CMAKE_RANLIB ${CLANG_ROOT}/bin/llvm-ranlib CACHE INTERNAL " " FORCE)
|
||||
set(CMAKE_OBJCOPY objcopy CACHE INTERNAL " " FORCE)
|
||||
set(CMAKE_READELF readelf CACHE INTERNAL " " FORCE)
|
||||
find_program(CMAKE_C_COMPILER clang PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_CXX_COMPILER clang++ PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_AR llvm-ar PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_LINKER llvm-link PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_NM llvm-nm PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_OBJDUMP llvm-objdump PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_RANLIB llvm-ranlib PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
||||
find_program(CMAKE_OBJCOPY objcopy PATH ${TOOLCHAIN_HOME})
|
||||
find_program(CMAKE_READELF readelf PATH ${TOOLCHAIN_HOME})
|
||||
|
||||
foreach(file_name include include-fixed)
|
||||
execute_process(
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
set(CLANG_ROOT $ENV{CLANG_ROOT_DIR})
|
||||
set_ifndef(CLANG_ROOT /usr)
|
||||
|
||||
set(TOOLCHAIN_HOME ${CLANG_ROOT}/bin/)
|
||||
|
||||
set(COMPILER clang)
|
||||
|
||||
if("${ARCH}" STREQUAL "arm")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue