Skip to content

Commit 129ae37

Browse files
ozhurakinashif
authored andcommitted
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 <[email protected]>
1 parent 274a4a2 commit 129ae37

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cmake/toolchain/llvm/generic.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
set(CLANG_ROOT $ENV{CLANG_ROOT_DIR})
4-
set_ifndef(CLANG_ROOT /usr)
5-
6-
set(TOOLCHAIN_HOME ${CLANG_ROOT}/bin/)
3+
if(DEFINED $ENV{CLANG_ROOT_DIR})
4+
set(TOOLCHAIN_HOME ${CLANG_ROOT}/bin/)
5+
endif()
76

87
set(COMPILER clang)
98
set(LINKER ld) # TODO: Use lld eventually rather than GNU ld
@@ -18,3 +17,7 @@ endif()
1817
set(CMAKE_C_COMPILER_TARGET ${triple})
1918
set(CMAKE_ASM_COMPILER_TARGET ${triple})
2019
set(CMAKE_CXX_COMPILER_TARGET ${triple})
20+
21+
if("${ARCH}" STREQUAL "posix")
22+
set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
23+
endif()

0 commit comments

Comments
 (0)