FindLTTngUST: Fix version component extraction

The regex was greedy and slurped away all but the last digit,
so 2.13.1 was for ex. detected as 2.3.1.
Fix this by expecting preceding whitespace.
This commit is contained in:
Norbert Lange
2021-12-23 16:16:48 +01:00
committed by Brad King
parent 26ab790820
commit 4ce5765a86

View File

@@ -63,11 +63,11 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
REGEX "^[\t ]*#define[\t ]+LTTNG_UST_MINOR_VERSION[\t ]+[0-9]+[\t ]*$")
file(STRINGS "${lttngust_version_file}" lttngust_version_patch_string
REGEX "^[\t ]*#define[\t ]+LTTNG_UST_PATCHLEVEL_VERSION[\t ]+[0-9]+[\t ]*$")
string(REGEX REPLACE ".*([0-9]+).*" "\\1"
string(REGEX REPLACE ".*[\t ]+([0-9]+).*" "\\1"
lttngust_v_major "${lttngust_version_major_string}")
string(REGEX REPLACE ".*([0-9]+).*" "\\1"
string(REGEX REPLACE ".*[\t ]+([0-9]+).*" "\\1"
lttngust_v_minor "${lttngust_version_minor_string}")
string(REGEX REPLACE ".*([0-9]+).*" "\\1"
string(REGEX REPLACE ".*[\t ]+([0-9]+).*" "\\1"
lttngust_v_patch "${lttngust_version_patch_string}")
set(LTTNGUST_VERSION_STRING
"${lttngust_v_major}.${lttngust_v_minor}.${lttngust_v_patch}")