Cmake config: Respect the patch-level while creating package from tar/zip-source

Rename some variables to match the ones used by automake
Slightly modified patch from Eugene Chornyi <technikmagma@gmail.com>
This commit is contained in:
Kornel Benko 2020-01-18 10:40:31 +01:00
parent c9e8ed1153
commit d537d55b69
2 changed files with 18 additions and 5 deletions

View File

@ -361,12 +361,19 @@ foreach(_c_l ${_config_lines} )
setstripped(PACKAGE_BASE ${CMAKE_MATCH_1})
setstripped(PACKAGE_VERSION ${CMAKE_MATCH_2})
setstripped(PACKAGE_BUGREPORT ${CMAKE_MATCH_3})
if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\)?.*$")
if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\(\\.\([0-9]+\)\)?\)?.*$")
set(LYX_MAJOR_VERSION ${CMAKE_MATCH_1})
set(LYX_MINOR_VERSION ${CMAKE_MATCH_2})
set(LYX_PATCH_VERSION ${CMAKE_MATCH_4})
set(LYX_RELEASE_LEVEL ${CMAKE_MATCH_4})
set(LYX_RELEASE_PATCH ${CMAKE_MATCH_6})
set(LYX_DIR_VER "LYX_DIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
set(LYX_USERDIR_VER "LYX_USERDIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
if (NOT LYX_RELEASE_LEVEL)
set(LYX_RELEASE_LEVEL 0)
endif()
if (NOT LYX_RELEASE_PATCH)
set(LYX_RELEASE_PATCH 0)
endif()
if ("${LYX_SUFFIX_VALUE}" MATCHES "")
set(LYX_INSTALL_SUFFIX "${LYX_MAJOR_VERSION}.${LYX_MINOR_VERSION}")
else()
@ -381,11 +388,11 @@ endforeach(_c_l)
FIND_PROGRAM(LYX_GITVERSION git)
#message(STATUS "gitversion = ${LYX_GITVERSION}")
set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION})
set(LYX_REVISION_VERSION ${LYX_RELEASE_LEVEL})
set(LYX_PACKAGE_RELEASE "1")
if(LYX_GITVERSION)
if (LYX_LOCALVERSIONING)
# Find the revision number and for later use
# Find the revision number for later use
EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} describe --match 2.0.0 HEAD
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE tmp_LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
if (tmp_LYX_PACKAGE_RELEASE MATCHES "^2\\.0\\.0\\-\([0-9]+\)\\-\(.*\)$")
@ -394,10 +401,14 @@ if(LYX_GITVERSION)
# previous svn.
# We use this value than also to set the package-patch-value
MATH(EXPR tmp_REVISION_VERSION "(${CMAKE_MATCH_1}+40000)")
set(LYX_REVISION_VERSION "${LYX_PATCH_VERSION}-${tmp_REVISION_VERSION}git")
set(LYX_REVISION_VERSION "${LYX_RELEASE_LEVEL}-${tmp_REVISION_VERSION}git")
set(ENABLE_DIST ON)
endif()
endif()
else()
if (LYX_RELEASE_PATCH GREATER 0)
set(LYX_REVISION_VERSION "${LYX_RELEASE_LEVEL}.${LYX_RELEASE_PATCH}")
endif()
endif()
# Set the programs (lyx, tex2lyx, etc.) suffix

View File

@ -33,6 +33,8 @@
#cmakedefine LYX_USERDIR_VER "${LYX_USERDIR_VER}"
#define LYX_MAJOR_VERSION ${LYX_MAJOR_VERSION}
#define LYX_MINOR_VERSION ${LYX_MINOR_VERSION}
#define LYX_RELEASE_LEVEL ${LYX_RELEASE_LEVEL}
#define LYX_RELEASE_PATCH ${LYX_RELEASE_PATCH}
#define PROGRAM_SUFFIX "${PROGRAM_SUFFIX}"
#define LYX_ABS_INSTALLED_DATADIR "${LYX_ABS_INSTALLED_DATADIR}"