[llvm] [LLVM][Runtimes] Fix path attempting to install to wrong location (PR #202352)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 07:59:54 PDT 2026
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/202352
Summary:
When LLVM_BINARY_DIR was not set this should default to a root location
and configuration would fail by trying to write to some random system
location with insufficient perms.
Fixes the failure introduced in https://github.com/llvm/llvm-project/commit/b4f5ae234c6d
>From 7bc9fe79f0ed364218e4ca53a4adc53a2e4657f5 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Mon, 8 Jun 2026 09:58:07 -0500
Subject: [PATCH] [LLVM][Runtimes] Fix path attempting to install to wrong
location
Summary:
When LLVM_BINARY_DIR was not set this should default to a root location
and configuration would fail by trying to write to some random system
location with insufficient perms.
Fixes the failure introduced in https://github.com/llvm/llvm-project/commit/b4f5ae234c6d
---
runtimes/CMakeLists.txt | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 9d88dc1025749..f6debee97511f 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -63,18 +63,14 @@ function(runtime_register_component name)
set_property(GLOBAL APPEND PROPERTY SUB_COMPONENTS ${name})
endfunction()
-find_package(LLVM
- PATHS
- "${LLVM_BINARY_DIR}"
- "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH)
-find_package(Clang
- PATHS
- "${LLVM_BINARY_DIR}"
- "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang"
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH)
+set(llvm_search_paths "${LLVM_BINARY_DIR}")
+set(clang_search_paths "${LLVM_BINARY_DIR}")
+if(LLVM_BINARY_DIR)
+ list(APPEND llvm_search_paths "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ list(APPEND clang_search_paths "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
+endif()
+find_package(LLVM PATHS ${llvm_search_paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+find_package(Clang PATHS ${clang_search_paths} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
More information about the llvm-commits
mailing list