Skip to content

Commit

Permalink
GetClangResourceDir: Fix downstream projects that bundle llvm source
Browse files Browse the repository at this point in the history
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.

Reviewed By: sebastian-ne

Differential Revision: https://reviews.llvm.org/D152608
  • Loading branch information
tstellar committed Jul 6, 2023
1 parent cea3a89 commit c951960
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmake/Modules/GetClangResourceDir.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ function(get_clang_resource_dir out_var)
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()

Expand Down

0 comments on commit c951960

Please sign in to comment.