Build: Adjust CMake version search regex.

Now, the LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, and LZMA_VERSION_PATCH
macros do not need to be on consecutive lines in version.h. They can be
separated by more whitespace, comments, or even other content, as long
as they appear in the proper order (major, minor, patch).
This commit is contained in:
Jia Tan 2023-02-04 21:06:35 +08:00
parent b8bce89be7
commit 7673ef5aa8
1 changed files with 2 additions and 0 deletions

View File

@ -64,7 +64,9 @@ file(READ src/liblzma/api/lzma/version.h XZ_VERSION)
string(REGEX REPLACE string(REGEX REPLACE
"^.*\n\ "^.*\n\
#define LZMA_VERSION_MAJOR ([0-9]+)\n\ #define LZMA_VERSION_MAJOR ([0-9]+)\n\
.*\
#define LZMA_VERSION_MINOR ([0-9]+)\n\ #define LZMA_VERSION_MINOR ([0-9]+)\n\
.*\
#define LZMA_VERSION_PATCH ([0-9]+)\n\ #define LZMA_VERSION_PATCH ([0-9]+)\n\
.*$" .*$"
"\\1.\\2.\\3" XZ_VERSION "${XZ_VERSION}") "\\1.\\2.\\3" XZ_VERSION "${XZ_VERSION}")