Index: openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake =================================================================== --- openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake +++ openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake @@ -128,11 +128,17 @@ # Looking for AMD GPUs... ################################################################################ -find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch PATHS ${LLVM_BINARY_DIR}/bin) +if(TARGET amdgpu-arch) + get_property(LIBOMPTARGET_AMDGPU_ARCH TARGET amdgpu-arch PROPERTY LOCATION) + else() + find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch PATHS ${LLVM_BINARY_DIR}/bin) +endif() + if(LIBOMPTARGET_AMDGPU_ARCH) execute_process(COMMAND ${LIBOMPTARGET_AMDGPU_ARCH} OUTPUT_VARIABLE LIBOMPTARGET_AMDGPU_ARCH_OUTPUT - OUTPUT_STRIP_TRAILING_WHITESPACE) + OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND_ERROR_IS_FATAL ANY) string(REPLACE "\n" ";" amdgpu_arch_list "${LIBOMPTARGET_AMDGPU_ARCH_OUTPUT}") if(amdgpu_arch_list) set(LIBOMPTARGET_FOUND_AMDGPU_GPU TRUE)