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

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 02:28:28 PDT 2026


================
@@ -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)
----------------
ferdymercury wrote:

As said, that solution will not work because it will invalidate the workflow when -DLLVM_DIR is passed as a hint for the search, rather than being a sign that it was already found before.

> because `LLVM_FOUND` can easily fail across multiple scopes.

Since this is a specific downstream use case, I'd argue the calling side should take care of it being visible by downstream scopes. It's working fine on my side, but if not, I would just set as global property llvm_found to true or as a cache force.

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


More information about the cfe-commits mailing list