[Lldb-commits] [PATCH] D65798: [lldb][CMake] Infer `Clang_DIR` if not passed explicitly

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 04:46:56 PDT 2019


sgraenitz added a comment.

In D65798#1618609 <https://reviews.llvm.org/D65798#1618609>, @labath wrote:

> Making it so that the clang is automatically found it if happens to be next to llvm seems like a reasonable thing to me. I have no idea what would be the canonical cmake way to do that...


"the canonical cmake way" good question! It turns out that, providing another hint for `find_package(Clang ...)` does exactly that: it sets Clang_DIR to the first path where it found Clang. If we do not attach great importance to the status message, we could do:

  find_package(LLVM REQUIRED CONFIG HINTS ${LLVM_DIR} NO_CMAKE_FIND_ROOT_PATH)
  find_package(Clang REQUIRED CONFIG HINTS ${Clang_DIR} ${LLVM_DIR}/../clang NO_CMAKE_FIND_ROOT_PATH)
  
  # Clang_DIR is defined now even if the ${LLVM_DIR}/../clang fallback was used


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65798/new/

https://reviews.llvm.org/D65798





More information about the lldb-commits mailing list