Skip to content

Commit 58e067d

Browse files
committed
fix: fw version is git tag only; don't include dirty
1 parent 9bfbc5a commit 58e067d

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/ic_project.cmake

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function(ic_project
111111
else()
112112
set(has_git_tag 1)
113113
execute_process(
114-
COMMAND git describe --tags --dirty=+ --always --abbrev=7
114+
COMMAND git describe --tags --always --abbrev=7
115115
OUTPUT_VARIABLE git_tag
116116
OUTPUT_STRIP_TRAILING_WHITESPACE
117117
)
@@ -125,14 +125,6 @@ function(ic_project
125125
)
126126
set_definition("${out_git_hash}" ${git_hash} PARENT_SCOPE)
127127

128-
if(NOT DEFINED ${out_fw_version})
129-
if(${has_git_tag})
130-
set_definition("${out_fw_version}" ${git_tag} PARENT_SCOPE)
131-
else()
132-
set_definition("${out_fw_version}" ${git_hash} PARENT_SCOPE)
133-
endif()
134-
endif()
135-
136128
# Set git dirty commit
137129
string(FIND ${git_hash} + res)
138130
if(res EQUAL -1)
@@ -160,6 +152,18 @@ function(ic_project
160152
set_definition("${out_git_tag_rev}" "" PARENT_SCOPE)
161153
endif()
162154

155+
if(NOT DEFINED ${out_fw_version})
156+
if(${has_git_tag})
157+
if(NOT "${git_tag_rev}" STREQUAL "")
158+
set_definition("${out_fw_version}" "${git_label}-${git_tag_rev}" PARENT_SCOPE)
159+
else()
160+
set_definition("${out_fw_version}" "${git_label}" PARENT_SCOPE)
161+
endif()
162+
else()
163+
set_definition("${out_fw_version}" ${git_hash} PARENT_SCOPE)
164+
endif()
165+
endif()
166+
163167
string(TIMESTAMP build_date "%Y%m%d")
164168
set_definition("${out_build_date}" ${build_date} PARENT_SCOPE)
165169
string(TIMESTAMP timestamp)

0 commit comments

Comments
 (0)