zephyr/cmake/toolchain/llvm/generic.cmake
Anas Nashif 03de10091a clang: use LLVM_TOOLCHAIN_PATH instead of CLANG_ROOT_DIR
Be consistent with other toolchains.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-11-02 14:30:37 -05:00

34 lines
975 B
CMake

# SPDX-License-Identifier: Apache-2.0
set_ifndef(LLVM_TOOLCHAIN_PATH "$ENV{CLANG_ROOT_DIR}")
set_ifndef(LLVM_TOOLCHAIN_PATH "$ENV{LLVM_TOOLCHAIN_PATH}")
if(LLVM_TOOLCHAIN_PATH)
set(TOOLCHAIN_HOME ${LLVM_TOOLCHAIN_PATH}/bin/)
endif()
set(LLVM_TOOLCHAIN_PATH ${CLANG_ROOT_DIR} CACHE PATH "clang install directory")
set(COMPILER clang)
set(LINKER ld) # TODO: Use lld eventually rather than GNU ld
set(BINTOOLS llvm)
if("${ARCH}" STREQUAL "arm")
set(triple arm-none-eabi)
set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
elseif("${ARCH}" STREQUAL "x86")
if(CONFIG_64BIT)
set(triple x86_64-pc-none-elf)
else()
set(triple i686-pc-none-elf)
endif()
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()
message(STATUS "Found toolchain: host (clang/ld)")