[clang] [clang] prevent double package search if LLVM already found in parent directory (PR #218965)

via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 30 13:55:55 PDT 2026


https://github.com/ferdymercury updated https://github.com/llvm/llvm-project/pull/218965

>From 12ca80e6f6dd4ae21051b6c0ec18a8cff40666ad Mon Sep 17 00:00:00 2001
From: ferdymercury <ferdymercury at users.noreply.github.com>
Date: Wed, 26 Aug 2026 17:46:17 +0200
Subject: [PATCH] [clang] prevent double package search if LLVM already found
 in parent directory

Alternative to https://github.com/llvm/llvm-project/pull/135570
---
 clang/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f8d57839805cb..760a38701e9b3 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -45,7 +45,9 @@ if(CLANG_BUILT_STANDALONE)
     mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
   endif()
 
-  find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
+  if(NOT LLVM_FOUND)
+    find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
+  endif()
   list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
 
   # Turn into CACHE PATHs for overwritting



More information about the cfe-commits mailing list