File tree 2 files changed +15
-4
lines changed
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -167,10 +167,21 @@ set(LDC_GENERATED
167
167
# Gather source files.
168
168
#
169
169
include (GetGitRevisionDescription)
170
- get_git_head_revision(REFSPEC HASH)
171
- if (NOT HASH STREQUAL "GITDIR-NOTFOUND" )
172
- string (SUBSTRING "${HASH} " 0 6 LDC_VERSION)
170
+ git_get_exact_tag(TAG)
171
+ if (NOT TAG MATCHES "NOTFOUND" )
172
+ if (TAG MATCHES "v[0-9].*" )
173
+ # For a version tag, remove the leading 'v'.
174
+ string (SUBSTRING "${TAG} " 1 -1 LDC_VERSION)
175
+ else ()
176
+ set (LDC_VERSION "${TAG} " )
177
+ endif ()
178
+ else ()
179
+ get_git_head_revision(REFSPEC HASH)
180
+ if (NOT HASH STREQUAL "GITDIR-NOTFOUND" )
181
+ string (SUBSTRING "${HASH} " 0 6 LDC_VERSION)
182
+ endif ()
173
183
endif ()
184
+ message (STATUS "LDC version identifier: ${LDC_VERSION} " )
174
185
configure_file (driver/ldc-version .cpp.in driver/ldc-version .cpp)
175
186
176
187
# Also add the header files to the build so that they are available in IDE
Original file line number Diff line number Diff line change @@ -118,6 +118,6 @@ function(git_describe _var)
118
118
endfunction ()
119
119
120
120
function (git_get_exact_tag _var)
121
- git_describe(out --exact-match ${ARGN} )
121
+ git_describe(out --exact-match --tag ${ARGN} )
122
122
set (${_var} "${out} " PARENT_SCOPE)
123
123
endfunction ()
You can’t perform that action at this time.
0 commit comments