Skip to content
Permalink
Browse files

cmake: clang: Detect host installed clang

In case TOOLCHAIN_HOME isn't explicitly reuqested,
(or indirectly forced with CLANG_ROOT_DIR), detect
any host installed clang in the path.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
  • Loading branch information...
ozhuraki authored and nashif committed Mar 8, 2019
1 parent 129ae37 commit 2688bfad8e09b9535e090a629e9be07d8ad48482
Showing with 22 additions and 10 deletions.
  1. +6 −1 cmake/compiler/clang/generic.cmake
  2. +16 −9 cmake/compiler/clang/target.cmake
@@ -1,3 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

find_program(CMAKE_C_COMPILER clang PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
if(DEFINED TOOLCHAIN_HOME)
set(find_program_clang_args PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
endif()

find_program(CMAKE_C_COMPILER clang ${find_program_clang_args})

@@ -11,15 +11,22 @@ if(NOT DEFINED NOSYSDEF_CFLAG)
set(NOSYSDEF_CFLAG -undef)
endif()

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})
if(DEFINED TOOLCHAIN_HOME)
set(find_program_clang_args PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
set(find_program_binutils_args PATH ${TOOLCHAIN_HOME})
endif()


find_program(CMAKE_C_COMPILER clang ${find_program_clang_args})
find_program(CMAKE_CXX_COMPILER clang++ ${find_program_clang_args})
find_program(CMAKE_AR llvm-ar ${find_program_clang_args})
find_program(CMAKE_LINKER llvm-link ${find_program_clang_args})
find_program(CMAKE_NM llvm-nm ${find_program_clang_args})
find_program(CMAKE_OBJDUMP llvm-objdump ${find_program_clang_args})
find_program(CMAKE_RANLIB llvm-ranlib ${find_program_clang_args})

find_program(CMAKE_OBJCOPY objcopy ${find_program_binutils_args})
find_program(CMAKE_READELF readelf ${find_program_binutils_args})

foreach(file_name include include-fixed)
execute_process(

0 comments on commit 2688bfa

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