[Openmp-commits] [PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

Sebastian Neubauer via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Jun 9 06:35:21 PDT 2023


sebastian-ne added inline comments.


================
Comment at: cmake/Modules/GetClangResourceDir.cmake:15
+  else()
+    string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION})
+    set(ret_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR})
----------------
This fails in our downstream project.
We use add_subdirectory() to include LLVM and our parent project already sets PACKAGE_VERSION to something that is not the LLVM version.

Parsing PACKAGE_VERSION only if CLANG_VERSION_MAJOR is not already known seems to work:
```
    if (NOT CLANG_VERSION_MAJOR)
      string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION})
    endif()
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141907



More information about the Openmp-commits mailing list