[llvm] [offload] Permit redefining OPENMP_STANDALONE_BUILD (PR #157253)

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 6 05:35:49 PDT 2025


https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/157253

Permit redefining `OPENMP_STANDALONE_BUILD` to make it possible to build offload correctly via runtimes build (i.e. build where the top-level project is `runtimes`).  This follows the same logic in `openmp` component.

>From e1ef99ba45161b2006f3e0d3b3b606db309c074d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Sat, 6 Sep 2025 14:33:31 +0200
Subject: [PATCH] [offload] Permit redefining OPENMP_STANDALONE_BUILD
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Permit redefining `OPENMP_STANDALONE_BUILD` to make it possible
to build offload correctly via runtimes build (i.e. build where
the top-level project is `runtimes`).  This follows the same logic
in `openmp` component.

Signed-off-by: Michał Górny <mgorny at gentoo.org>
---
 offload/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 38fa77e41bb53..a16c7dff3fd04 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -4,7 +4,8 @@
 cmake_minimum_required(VERSION 3.20.0)
 set(LLVM_SUBPROJECT_TITLE "liboffload")
 
-if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+# Permit redefining OPENMP_STANDALONE_BUILD when doing a runtimes build.
+if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   set(OPENMP_STANDALONE_BUILD TRUE)
   project(offload C CXX ASM)
 else()



More information about the llvm-commits mailing list