Make the version as part of package name of

cmake build be configurable.
Use -DLYX_LOCALVERSIONING=ON (default = OFF)
The package name will then be
	lyx-2.1.0-xxxxgit-yyyy.zzz
where xxxx == version number (similar to svn)
      yyyy == your OS (e.g. Linux)
      zzz  == package extension (e.g. deb, rpm, tar.gz etc)

otherwise the string '-xxxxgit' will not be used.
This commit is contained in:
Kornel Benko 2012-03-15 13:01:09 +01:00
parent 1e0f2426ce
commit 88cb217361

View File

@ -71,6 +71,7 @@ LYX_OPTION_INIT()
# Options for all compilers/systems # Options for all compilers/systems
LYX_OPTION(CPACK "Use the CPack management (Implies LYX_INSTALL option)" OFF ALL) LYX_OPTION(CPACK "Use the CPack management (Implies LYX_INSTALL option)" OFF ALL)
LYX_OPTION(LOCALVERSIONING "Add version info to created package name (only used if LYX_CPACK option set)" OFF ALL)
LYX_OPTION(INSTALL "Build install projects/rules (implies a bunch of other options)" OFF ALL) LYX_OPTION(INSTALL "Build install projects/rules (implies a bunch of other options)" OFF ALL)
LYX_OPTION(NLS "Enable Native Language Support (NLS)" ON ALL) LYX_OPTION(NLS "Enable Native Language Support (NLS)" ON ALL)
LYX_OPTION(ASPELL "Require aspell" OFF ALL) LYX_OPTION(ASPELL "Require aspell" OFF ALL)
@ -250,20 +251,26 @@ foreach(_c_l ${_config_lines} )
endif() endif()
endforeach(_c_l) endforeach(_c_l)
# Find the revision number and for later use if (LYX_LOCALVERSIONING)
FIND_PROGRAM(LYX_SVNVERSION svnversion) # Find the revision number and for later use
#message(STATUS "svnversion = ${LYX_SVNVERSION}") FIND_PROGRAM(LYX_GITVERSION git)
if(LYX_SVNVERSION) #message(STATUS "gitversion = ${LYX_GITVERSION}")
EXECUTE_PROCESS(COMMAND ${LYX_SVNVERSION} WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) if(LYX_GITVERSION)
# We use this value also to set the package-patch-value EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} "describe" WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
if(LYX_PACKAGE_RELEASE MATCHES "^\([0-9]+\)") if (LYX_PACKAGE_RELEASE MATCHES "^2\\.0\\.0\\-\([0-9]+\)\\-.*$")
set(LYX_REVISION_VERSION ${CMAKE_MATCH_1}) # We will add offset of 40000 to get appropriate value to
# 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")
endif()
else()
set(LYX_REVISION_VERSION git) #TODO use date
endif() endif()
else() else()
set(LYX_REVISION_VERSION svn) #TODO use date set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION})
endif() endif()
if(LYX_PROGRAM_SUFFIX) if(LYX_PROGRAM_SUFFIX)
set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}") set(PROGRAM_SUFFIX "${LYX_INSTALL_SUFFIX}")
else() else()