From 12537ac90c8798abbf8599098b8d02d7c04e7269 Mon Sep 17 00:00:00 2001 From: Joachim Protze Date: Mon, 30 Aug 2021 16:50:21 +0200 Subject: [PATCH] [libomptarget][amdcgn] Only add opt/llvm-link dependency if TARGET is available In some build configurations, the target we depend on is not available for declaring the build dependency. We only need to declare the build dependency, if the build target is available in the same build. Fixes the issue raised in https://reviews.llvm.org/D107156#2969862 This patch should go into release/13 together with D108404 Differential Revision: https://reviews.llvm.org/D108868 (cherry picked from commit 5ea1c37118699f0ed1da17e0d8562011d0002edd) --- runtimes/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index b972933b1f7..3436cd8bdfb 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -350,9 +350,14 @@ if(runtimes) # Create a runtimes target that uses this file as its top-level CMake file. # The runtimes target is a configuration of all the runtime libraries # together in a single CMake invocaiton. + set(extra_deps "") if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES) - message(STATUS "Adding dependencies opt llvm-link") - set(extra_deps opt llvm-link) + if(TARGET opt) + list(APPEND extra_deps opt) + endif() + if(TARGET llvm-link) + list(APPEND extra_deps llvm-link) + endif() endif() if(NOT LLVM_RUNTIME_TARGETS) runtime_default_target(