[PATCH] D152608: GetClangResourceDir: Fix downstream projects that bundle llvm source

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 21:56:46 PDT 2023


tstellar created this revision.
tstellar added reviewers: sebastian-ne, paperchalice.
Herald added a project: All.
tstellar requested review of this revision.

A project that bundles the llvm source code may have their own
PACKAGE_VERSION variable, so only use this to compute the
CLANG_RESOURCE_DIR if CLANG_VERSION_MAJOR is undefined.


https://reviews.llvm.org/D152608

Files:
  cmake/Modules/GetClangResourceDir.cmake


Index: cmake/Modules/GetClangResourceDir.cmake
===================================================================
--- cmake/Modules/GetClangResourceDir.cmake
+++ cmake/Modules/GetClangResourceDir.cmake
@@ -12,7 +12,9 @@
   if(DEFINED CLANG_RESOURCE_DIR AND NOT CLANG_RESOURCE_DIR STREQUAL "")
     set(ret_dir bin/${CLANG_RESOURCE_DIR})
   else()
-    string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION})
+    if (NOT CLANG_VERSION_MAJOR)
+      string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION})
+    endif()
     set(ret_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR})
   endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152608.530154.patch
Type: text/x-patch
Size: 630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230610/6d63050c/attachment.bin>


More information about the llvm-commits mailing list