File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ file(STRINGS "VERSION" VERSION_PLAIN)
45
45
string (REGEX REPLACE "^([^.]*)\\ ..*" "\\ 1" VERSION_MAJOR ${VERSION_PLAIN} )
46
46
string (REGEX REPLACE "^[^.]*\\ .([^.]*)\\ ..*" "\\ 1" VERSION_MINOR ${VERSION_PLAIN} )
47
47
string (REGEX REPLACE "^[^.]*\\ .[^.]*\\ .([0-9]*).*" "\\ 1" VERSION_PATCH ${VERSION_PLAIN} )
48
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR} /.git)
49
+ execute_process (COMMAND git describe --abbrev=4
50
+ OUTPUT_VARIABLE GIT_REV)
51
+ string (REGEX REPLACE "\n $" "" PACKAGE_VERSION "${GIT_REV} " )
52
+ elseif ()
53
+ set (PACKAGE_VERSION ${VERSION_PLAIN} )
54
+ endif ()
48
55
49
56
# Provide also same macro names as autoconf (see configure.ac).
50
57
set (GENERIC_MAJOR_VERSION ${VERSION_MAJOR} )
Original file line number Diff line number Diff line change @@ -119,10 +119,9 @@ set(types_list
119
119
)
120
120
check_types(types_list)
121
121
122
- set (PACKAGE_VERSION "${VERSION_PLAIN} " )
123
122
file (APPEND ${AUTOCONFIG_SRC} "
124
123
/* Version number */
125
- #cmakedefine PACKAGE_VERSION \" ${VERSION_PLAIN } \"
124
+ #cmakedefine PACKAGE_VERSION \" ${PACKAGE_VERSION } \"
126
125
" )
127
126
128
127
test_big_endian(WORDS_BIGENDIAN)
You can’t perform that action at this time.
0 commit comments