diff --git a/cmake/Modules/GetClangResourceDir.cmake b/cmake/Modules/GetClangResourceDir.cmake --- a/cmake/Modules/GetClangResourceDir.cmake +++ b/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()