File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,21 @@ endfunction()
39
39
if (GIT_VERSION AND NOT ${GIT_INFO} STREQUAL "")
40
40
message("-- Using Git to calculate AWS IoT Device Client version information...")
41
41
42
- # Get last tag from git - this only matches tags starting with v, so we ignore non-versioning tags
43
- execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags --match "v[0-9]*"
42
+ # Get first tag with major and minor of the latest tag.
43
+ execute_process(
44
+ COMMAND bash -c "
45
+ read LATEST_MAJOR_VERSION LATEST_MINOR_VERSION < <(git describe --abbrev=0 --tags | awk -F. '
46
+ {
47
+ gsub(/^v/, \"\", \$0)
48
+
49
+ split(\$0, parts, \".\")
50
+ LATEST_MAJOR_VERSION = parts[1]
51
+ LATEST_MINOR_VERSION = parts[2]
52
+ print LATEST_MAJOR_VERSION, LATEST_MINOR_VERSION
53
+
54
+ }')
55
+ git tag --sort=creatordate | grep -E \"^v?\${LATEST_MAJOR_VERSION}\.\${LATEST_MINOR_VERSION}(\\.\[0-9]+)?\" | head -n 1
56
+ "
44
57
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
45
58
OUTPUT_VARIABLE ${PROJECT_NAME}_VERSION_STRING
46
59
OUTPUT_STRIP_TRAILING_WHITESPACE
You can’t perform that action at this time.
0 commit comments