From 58e067dfd37282d339904409a989e6b168d140bd Mon Sep 17 00:00:00 2001 From: "J.P. Hutchins" Date: Tue, 5 Dec 2023 14:39:09 -0800 Subject: [PATCH] fix: fw version is git tag only; don't include dirty --- src/ic_project.cmake | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ic_project.cmake b/src/ic_project.cmake index 59d2f63..5904a51 100644 --- a/src/ic_project.cmake +++ b/src/ic_project.cmake @@ -111,7 +111,7 @@ function(ic_project else() set(has_git_tag 1) execute_process( - COMMAND git describe --tags --dirty=+ --always --abbrev=7 + COMMAND git describe --tags --always --abbrev=7 OUTPUT_VARIABLE git_tag OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -125,14 +125,6 @@ function(ic_project ) set_definition("${out_git_hash}" ${git_hash} PARENT_SCOPE) - if(NOT DEFINED ${out_fw_version}) - if(${has_git_tag}) - set_definition("${out_fw_version}" ${git_tag} PARENT_SCOPE) - else() - set_definition("${out_fw_version}" ${git_hash} PARENT_SCOPE) - endif() - endif() - # Set git dirty commit string(FIND ${git_hash} + res) if(res EQUAL -1) @@ -160,6 +152,18 @@ function(ic_project set_definition("${out_git_tag_rev}" "" PARENT_SCOPE) endif() + if(NOT DEFINED ${out_fw_version}) + if(${has_git_tag}) + if(NOT "${git_tag_rev}" STREQUAL "") + set_definition("${out_fw_version}" "${git_label}-${git_tag_rev}" PARENT_SCOPE) + else() + set_definition("${out_fw_version}" "${git_label}" PARENT_SCOPE) + endif() + else() + set_definition("${out_fw_version}" ${git_hash} PARENT_SCOPE) + endif() + endif() + string(TIMESTAMP build_date "%Y%m%d") set_definition("${out_build_date}" ${build_date} PARENT_SCOPE) string(TIMESTAMP timestamp)