Try to use version information from git
This commit is contained in:
parent
10bdf90fe2
commit
3304b718aa
@ -13,13 +13,25 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
|
||||
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
|
||||
|
||||
# Version
|
||||
set (project_VERSION_MAJOR "0")
|
||||
set (project_VERSION_MINOR "9")
|
||||
set (project_VERSION_PATCH "2")
|
||||
set (project_version "0.9.2")
|
||||
|
||||
set (project_VERSION "${project_VERSION_MAJOR}")
|
||||
set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}")
|
||||
set (project_VERSION "${project_VERSION}.${project_VERSION_PATCH}")
|
||||
# Try to append commit ID if it follows a version tag. It might be nicer if
|
||||
# we could also detect dirty worktrees but that's very hard to get right.
|
||||
find_package (Git)
|
||||
set (git_head "${PROJECT_SOURCE_DIR}/.git/HEAD")
|
||||
if (GIT_FOUND AND EXISTS ${git_head})
|
||||
configure_file (${git_head} git-head.tag COPYONLY)
|
||||
execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags --match v*
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE git_describe_result
|
||||
OUTPUT_VARIABLE git_describe OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if (NOT git_describe_result)
|
||||
string (REGEX REPLACE "^v" "" project_version "${git_describe}")
|
||||
endif (NOT git_describe_result)
|
||||
endif (GIT_FOUND AND EXISTS ${git_head})
|
||||
|
||||
# Dashes make filenames confusing and upset packaging software
|
||||
string (REPLACE "-" "+" project_version_safe "${project_version}")
|
||||
|
||||
# Dependencies
|
||||
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/liberty/cmake)
|
||||
@ -197,19 +209,19 @@ endforeach (page)
|
||||
|
||||
# CPack
|
||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Experimental IRC client, daemon and bot")
|
||||
set (CPACK_PACKAGE_VERSION ${project_VERSION})
|
||||
set (CPACK_PACKAGE_VERSION "${project_version_safe}")
|
||||
set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
|
||||
set (CPACK_PACKAGE_CONTACT "Přemysl Janouch <p.janouch@gmail.com>")
|
||||
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
|
||||
set (CPACK_GENERATOR "TGZ;ZIP")
|
||||
set (CPACK_PACKAGE_FILE_NAME
|
||||
"${PROJECT_NAME}-${project_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${project_VERSION}")
|
||||
"${PROJECT_NAME}-${project_version_safe}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${project_version_safe}")
|
||||
|
||||
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
||||
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
|
||||
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${project_VERSION}")
|
||||
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${project_version_safe}")
|
||||
|
||||
set (CPACK_SET_DESTDIR TRUE)
|
||||
include (CPack)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#define PROGRAM_VERSION "${project_VERSION}"
|
||||
#define PROGRAM_VERSION "${project_version}"
|
||||
#define ZYKLONB_PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${zyklonb_plugin_dir}"
|
||||
|
||||
#cmakedefine HAVE_READLINE
|
||||
|
Loading…
Reference in New Issue
Block a user