[LLVM][Runtimes] Fix path attempting to install to wrong location (#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
This commit is contained in:
Joseph Huber 2026-06-08 10:00:36 -05:00 committed by GitHub
parent 76699bcfc8
commit 12ebb8f106
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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")