Skip to content
Permalink
Browse files

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>
  • Loading branch information...
ozhuraki authored and nashif committed Mar 8, 2019
1 parent 274a4a2 commit 129ae378c0ade8bad017c0c52742f3646c110263
Showing with 7 additions and 4 deletions.
  1. +7 −4 cmake/toolchain/llvm/generic.cmake
@@ -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()

0 comments on commit 129ae37

Please sign in to comment.
You can’t perform that action at this time.