[Openmp-commits] [openmp] [OpenMP] Fix LLVM_ENABLE_PROJECTS=openmp build (PR #151117)

Michael Kruse via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 29 03:16:01 PDT 2025


https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/151117

Set LLVM_TREE_AVAILABLE when not defined after #149871. In particular, the LLVM build tree is obviously available with `add_subdirectory(openmp)` from the LLVM build tree itself. Note that this build mode is deprecated since #136314.

>From 5a2d2a35b741a93ea1419baf72e098aa9dd72e66 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Tue, 29 Jul 2025 12:10:41 +0200
Subject: [PATCH] [OpenMP] Fix LLVM_ENABLE_PROJECTS=openmp build

---
 openmp/CMakeLists.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index ab34851d8961c..edd79df7fb767 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -21,6 +21,8 @@ endif()
 include(GNUInstallDirs)
 
 if (OPENMP_STANDALONE_BUILD)
+  set(LLVM_TREE_AVAILABLE False)
+
   # CMAKE_BUILD_TYPE was not set, default to Release.
   if (NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE Release)
@@ -48,6 +50,15 @@ if (OPENMP_STANDALONE_BUILD)
   set(CMAKE_CXX_STANDARD_REQUIRED NO)
   set(CMAKE_CXX_EXTENSIONS NO)
 else()
+  # Usually <llvm-project>/runtimes/CMakeLists.txt sets LLVM_TREE_AVAILABLE and
+  # we assume it is not available otherwise. The exception is that we are in an
+  # LLVM_ENABLE_PROJECTS=openmp build, the LLVM tree is actually available.
+  # Note that this build mode has been deprecated.
+  # See https://github.com/llvm/llvm-project/issues/124014
+  if (NOT LLVM_RUNTIMES_BUILD AND "openmp" IN_LIST LLVM_ENABLE_PROJECTS)
+    set(LLVM_TREE_AVAILABLE True)
+  endif ()
+
   set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
 
   # When building in tree we install the runtime according to the LLVM settings.



More information about the Openmp-commits mailing list