[PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

Tom Stellard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 4 17:28:03 PDT 2023


tstellar added inline comments.


================
Comment at: cmake/Modules/GetClangResourceDir.cmake:13
+  if(DEFINED CLANG_RESOURCE_DIR AND NOT CLANG_RESOURCE_DIR STREQUAL "")
+    set(ret_dir bin/${CLANG_RESOURCE_DIR})
+  else()
----------------
tstellar wrote:
> paperchalice wrote:
> > tstellar wrote:
> > > Why is the bin prefix here?
> > See https://clang.llvm.org/doxygen/classclang_1_1driver_1_1Driver.html#acda8dfdf4f80efa84df98157e1779152
> > `GetResourcesPath` will return `<prefix>/lib/<version>` when `CLANG_RESOURCE_DIR` is empty, `<prefix>/bin/CLANG_RESOURCE_DIR` otherwise.
> > 
> `GetResourcesPath` calls `sys::path::parent_path` twice on the path to the clang executable which is going to give you `/usr ` on most Linux systems, so it's returning `<prefix>/CLANG_RESOURCE_DIR` not `<prefix>/bin/CLANG_RESOURCE_DIR`.
Sorry, you are correct.  I was looking at the wrong branch.  It's really strange that it does that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141907



More information about the cfe-commits mailing list