From 5914e5c6e26b81c717bbc6bcaa8449645618c542 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 18 Dec 2015 14:24:01 +0000 Subject: Support GIT_ID variable --- CMakeLists.txt | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index add82c152..263249f38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,11 @@ SET(RSPAMD_VERSION_MAJOR 1) SET(RSPAMD_VERSION_MINOR 1) SET(RSPAMD_VERSION_PATCH 0) +IF(GIT_ID) + SET(GIT_VERSION 1) + SET(RSPAMD_ID "${GIT_ID}") +ENDIF() + SET(RSPAMD_VERSION "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}.${RSPAMD_VERSION_PATCH}") SET(RSPAMD_MASTER_SITE_URL "https://rspamd.com") @@ -984,39 +989,6 @@ IF(NOT DESTDIR) SET(DESTDIR $ENV{DESTDIR}) ENDIF(NOT DESTDIR) -# Try to detect tip version from hg -SET(ID "unknown") -FIND_PROGRAM(HG "git") - -IF(HG) - EXECUTE_PROCESS(COMMAND "${HG}" rev-parse --verify HEAD - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - OUTPUT_VARIABLE HG_ID ERROR_QUIET) - IF(HG_ID) - STRING(SUBSTRING "${HG_ID}" 0 10 RSPAMD_ID) - MESSAGE(STATUS "Git revision: ${RSPAMD_ID}") - ELSE(HG_ID) - FIND_FILE(HG_ARCH ".hg_archival.txt" "${CMAKE_CURRENT_SOURCE_DIR}") - IF(HG_ARCH) - FILE(READ ${HG_ARCH} HG_ID) - IF(HG_ID) - STRING(REGEX MATCH "node: [0-9a-z]+" _tmp "${HG_ID}") - STRING(SUBSTRING "${_tmp}" 6 12 RSPAMD_ID) - ENDIF(HG_ID) - ENDIF(HG_ARCH) - ENDIF(HG_ID) -ELSE(HG) -# Now check .hg_archival.txt - FIND_FILE(HG_ARCH ".hg_archival.txt" "${CMAKE_CURRENT_SOURCE_DIR}") - IF(HG_ARCH) - FILE(READ ${HG_ARCH} HG_ID) - IF(HG_ID) - STRING(REGEX MATCH "node: [0-9a-z]+" _tmp "${HG_ID}") - STRING(SUBSTRING "${_tmp}" 6 12 RSPAMD_ID) - ENDIF(HG_ID) - ENDIF(HG_ARCH) -ENDIF(HG) - ################################ SUBDIRS SECTION ########################### -- cgit v1.2.3