mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-19 06:53:36 +08:00
fix cmake PACKAGE_VERSION to behave same way as in autotools
This commit is contained in:
parent
394839cdd7
commit
fd881e4486
@ -45,6 +45,13 @@ file(STRINGS "VERSION" VERSION_PLAIN)
|
||||
string(REGEX REPLACE "^([^.]*)\\..*" "\\1" VERSION_MAJOR ${VERSION_PLAIN})
|
||||
string(REGEX REPLACE "^[^.]*\\.([^.]*)\\..*" "\\1" VERSION_MINOR ${VERSION_PLAIN})
|
||||
string(REGEX REPLACE "^[^.]*\\.[^.]*\\.([0-9]*).*" "\\1" VERSION_PATCH ${VERSION_PLAIN})
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
execute_process(COMMAND git describe --abbrev=4
|
||||
OUTPUT_VARIABLE GIT_REV)
|
||||
string(REGEX REPLACE "\n$" "" PACKAGE_VERSION "${GIT_REV}")
|
||||
elseif()
|
||||
set(PACKAGE_VERSION ${VERSION_PLAIN})
|
||||
endif()
|
||||
|
||||
# Provide also same macro names as autoconf (see configure.ac).
|
||||
set(GENERIC_MAJOR_VERSION ${VERSION_MAJOR})
|
||||
|
@ -119,10 +119,9 @@ set(types_list
|
||||
)
|
||||
check_types(types_list)
|
||||
|
||||
set(PACKAGE_VERSION "${VERSION_PLAIN}")
|
||||
file(APPEND ${AUTOCONFIG_SRC} "
|
||||
/* Version number */
|
||||
#cmakedefine PACKAGE_VERSION \"${VERSION_PLAIN}\"
|
||||
#cmakedefine PACKAGE_VERSION \"${PACKAGE_VERSION}\"
|
||||
")
|
||||
|
||||
test_big_endian(WORDS_BIGENDIAN)
|
||||
|
Loading…
Reference in New Issue
Block a user