Skip to content

Commit 53843ee

Browse files
Request native clang only when cross-compiling (#464)
* Request native clang only when cross-compiling LLVM_USE_HOST_TOOLS may be set if LLVM is configured with LLVM_OPTIMIZED_TABLEGEN, which does not necessarily indicate cross-compilation or that clang will only execute on the target. By checking that CMAKE_CROSSCOMPILING is set, we ensure that we only build/use clang again if necessary for host execution. * fixup: CMAKE_CROSSCOMPILING implies LLVM_USE_HOST_TOOLS Co-authored-by: Wenju He <[email protected]> * fixup: also use CMAKE_CROSSCOMPILING in top-level CMakeLists.txt --------- Co-authored-by: Wenju He <[email protected]>
1 parent 9efcfb5 commit 53843ee

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set(CMAKE_MODULE_PATH
3535

3636
include(CMakeFunctions)
3737

38-
if(LLVM_USE_HOST_TOOLS AND OPENCL_CLANG_BUILD_EXTERNAL)
38+
if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
3939
include(CrossCompile)
4040
llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
4141
endif()

cl_headers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if(USE_PREBUILT_LLVM)
44
else()
55
set(CLANG_COMMAND $<TARGET_FILE:clang>)
66
endif()
7-
if(LLVM_USE_HOST_TOOLS AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
7+
if(CMAKE_CROSSCOMPILING AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
88
build_native_tool(clang CLANG_COMMAND)
99
endif()
1010
set(LINUX_RESOURCE_LINKER_COMMAND linux_resource_linker)

0 commit comments

Comments
 (0)