[llvm] [Offload] Fix CMake detection when it is not found (PR #90729)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 06:22:44 PDT 2024


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/90729

Summary:
This variable could be unset if not found or when building standalone.
We should check for that and set it to true or false.

Fixes: https://github.com/llvm/llvm-project/issues/90708


>From c3cab0a8a06f225a777dfec9badb5a42c4a84c1c Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 1 May 2024 08:19:00 -0500
Subject: [PATCH] [Offload] Fix CMake detection when it is not found

Summary:
This variable could be unset if not found or when building standalone.
We should check for that and set it to true or false.

Fixes: https://github.com/llvm/llvm-project/issues/90708
---
 offload/CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index a416ac29873f4f..42e0f5740f116d 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -302,7 +302,12 @@ endif()
 
 pythonize_bool(LIBOMPTARGET_OMPT_SUPPORT)
 
-set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${LLVM_LIBC_GPU_BUILD} CACHE BOOL
+if(${LLVM_LIBC_GPU_BUILD})
+  set(LIBOMPTARGET_HAS_LIBC TRUE)
+else()
+  set(LIBOMPTARGET_HAS_LIBC FALSE)
+endif()
+set(LIBOMPTARGET_GPU_LIBC_SUPPORT ${LIBOMPTARGET_HAS_LIBC} CACHE BOOL
     "Libomptarget support for the GPU libc")
 pythonize_bool(LIBOMPTARGET_GPU_LIBC_SUPPORT)
 



More information about the llvm-commits mailing list