[llvm] [Runtimes] Default build must use its own output dirs (PR #168266)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 16 04:19:47 PST 2025
https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/168266
Fix issue reported at https://github.com/llvm/llvm-project/pull/164794#issuecomment-3536253493
>From ce507a8441c51fa6098fc34b31e4a5ea2466f71f Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Sun, 16 Nov 2025 13:17:42 +0100
Subject: [PATCH] [Runtimes] Default build must use its own output dir
---
runtimes/CMakeLists.txt | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index b17bd8f665361..d9fcac3a646b8 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -77,11 +77,6 @@ if (NOT LLVM_FOUND)
set(LLVM_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
endif()
-# Setting these variables will allow the sub-build to put their outputs into
-# the library and bin directories of the top-level build.
-set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
-set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
-
# This variable makes sure that e.g. llvm-lit is found.
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm)
set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
@@ -99,6 +94,17 @@ if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSIO
set(LLVM_TREE_AVAILABLE ON)
endif()
+if(LLVM_TREE_AVAILABLE)
+ # Setting these variables will allow the sub-build to put their outputs into
+ # the library and bin directories of the top-level build.
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
+else()
+ # Use own build directory for artifact output.
+ set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/bin")
+endif()
+
# CMake omits default compiler include paths, but in runtimes build, we use
# -nostdinc and -nostdinc++ and control include paths manually so this behavior
# is undesirable. Filtering CMAKE_{LANG}_IMPLICIT_INCLUDE_DIRECTORIES to remove
More information about the llvm-commits
mailing list