cmake: llvm: Make the setup for host installed clang easier
The logic is practically intact and is the following: 1. Use any host installed llvm/clang in the path in case ZEPHYR_TOOLCHAIN_VARIANT=llvm is requested alone. 2. This can be further restricted with TOOLCHAIN_HOME. 3. And can be further overridden with CLANG_ROOT_DIR, like previously. So, only the unconditional restriction to /usr is lifted. Together with fixing the unconditional set of TOOLCHAIN_HOME by host tools for non-toolchain needs, this makes the logic more flexible. Now, after the logic is controllable by TOOLCHAIN_HOME, 3) might be an extra, but is left intact for backward compatibility. Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
parent
274a4a28df
commit
129ae378c0
1 changed files with 7 additions and 4 deletions
|
@ -1,9 +1,8 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(CLANG_ROOT $ENV{CLANG_ROOT_DIR})
|
||||
set_ifndef(CLANG_ROOT /usr)
|
||||
|
||||
set(TOOLCHAIN_HOME ${CLANG_ROOT}/bin/)
|
||||
if(DEFINED $ENV{CLANG_ROOT_DIR})
|
||||
set(TOOLCHAIN_HOME ${CLANG_ROOT}/bin/)
|
||||
endif()
|
||||
|
||||
set(COMPILER clang)
|
||||
set(LINKER ld) # TODO: Use lld eventually rather than GNU ld
|
||||
|
@ -18,3 +17,7 @@ endif()
|
|||
set(CMAKE_C_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_ASM_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
||||
|
||||
if("${ARCH}" STREQUAL "posix")
|
||||
set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue