view cmake/HGVersion.cmake @ 754:27043d74dc90

(Issue25) Align header contents in their own column. We now also stretch column 3 so that the contents are aligned with the descriptive labels without a space in between. Sadly this causes the quit button to be resized to it's minimum instead of sharing the space with the installation button as the installation button is so large that it squeezes the push button.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 07 Jul 2014 12:38:33 +0200
parents 7a8f5b85fd9a
children
line wrap: on
line source
# Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
#
# This file is Free Software under the GNU GPL (v>=2)
# and comes with ABSOLUTELY NO WARRANTY!
# See LICENSE.txt for details.

# This makes some variables available to generate a nice version number for
# hg managed repositories.
# It sets HG_REVISION_TAG to the value of the latest tag
# HG_REVISION_DIST to the differences between the tag and the current tip
# HG_REVISION_ID to the actual revision
# based on code found in the lemon graph library https://lemon.cs.elte.hu
# HG_REVISON to a nice combination of those.
find_package(Hg)
if (HG_FOUND)
  EXECUTE_PROCESS(
    COMMAND
    hg log -r. --template "{latesttag}"
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    OUTPUT_VARIABLE HG_REVISION_TAG
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
  EXECUTE_PROCESS(
    COMMAND
    hg log -r. --template "{latesttagdistance}"
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    OUTPUT_VARIABLE HG_REVISION_DIST
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
  EXECUTE_PROCESS(
    COMMAND
    hg log -r. --template "{node|short}"
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    OUTPUT_VARIABLE HG_REVISION_ID
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )

  IF(HG_REVISION_TAG STREQUAL "")
    SET(HG_REVISION_ID "hg-tip")
  ELSE()
    IF(HG_REVISION_TAG STREQUAL "null")
      SET(HG_REVISION_TAG "trunk")
    ELSEIF(HG_REVISION_TAG MATCHES "^r")
      STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG)
    ENDIF()
    IF(HG_REVISION_DIST STREQUAL "0")
      SET(HG_REVISION ${HG_REVISION_TAG})
    ELSE()
      SET(HG_REVISION
        "${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}")
    ENDIF()
  ENDIF()
ENDIF()

http://wald.intevation.org/projects/trustbridge/