diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt --- a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt +++ b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt @@ -43,12 +43,15 @@ NO_DEFAULT_PATH) find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) libomptarget_say("Building AMDGCN device RTL. Using clang: ${CLANG_TOOL}") -else() +elseif (LLVM_TOOL_CLANG_BUILD AND NOT CMAKE_CROSSCOMPILING AND NOT OPENMP_STANDALONE_BUILD) # LLVM in-tree builds may use CMake target names to discover the tools. set(CLANG_TOOL $<TARGET_FILE:clang>) set(LINK_TOOL $<TARGET_FILE:llvm-link>) set(OPT_TOOL $<TARGET_FILE:opt>) libomptarget_say("Building AMDGCN device RTL. Using clang from in-tree build") +else() + libomptarget_say("Not building AMDGCN device RTL. No appropriate clang found") + return() endif() project(omptarget-amdgcn)