Mercurial > retraceit
annotate cmake/HGVersion.cmake @ 59:72e5a9c8e7e1
Fix filename for macos icon
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 19 May 2015 16:01:20 +0200 |
parents | 147b08bc7d64 |
children |
rev | line source |
---|---|
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 # Software engineering by Intevation GmbH |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 # |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 # This file is Free Software under the GNU GPL (v>=2) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 # and comes with ABSOLUTELY NO WARRANTY! |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 # See LICENSE.txt for details. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 # This makes some variables available to generate a nice version number for |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 # hg managed repositories. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 # It sets HG_REVISION_TAG to the value of the latest tag |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 # HG_REVISION_DIST to the differences between the tag and the current tip |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 # HG_REVISION_ID to the actual revision |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 # based on code found in the lemon graph library https://lemon.cs.elte.hu |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 # HG_REVISON to a nice combination of those. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 find_package(Hg) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 if (HG_FOUND) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 EXECUTE_PROCESS( |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 COMMAND |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 hg log -r. --template "{latesttag}" |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 OUTPUT_VARIABLE HG_REVISION_TAG |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 ERROR_QUIET |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 OUTPUT_STRIP_TRAILING_WHITESPACE |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 ) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 EXECUTE_PROCESS( |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 COMMAND |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 hg log -r. --template "{latesttagdistance}" |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 OUTPUT_VARIABLE HG_REVISION_DIST |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 ERROR_QUIET |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 OUTPUT_STRIP_TRAILING_WHITESPACE |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 ) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 EXECUTE_PROCESS( |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 COMMAND |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 hg log -r. --template "{node|short}" |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 OUTPUT_VARIABLE HG_REVISION_ID |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 ERROR_QUIET |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 OUTPUT_STRIP_TRAILING_WHITESPACE |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 ) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 IF(HG_REVISION_TAG STREQUAL "") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 SET(HG_REVISION_ID "hg-tip") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 ELSE() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 IF(HG_REVISION_TAG STREQUAL "null") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 SET(HG_REVISION_TAG "trunk") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 ELSEIF(HG_REVISION_TAG MATCHES "^r") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 ENDIF() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 IF(HG_REVISION_DIST STREQUAL "0") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 SET(HG_REVISION ${HG_REVISION_TAG}) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 ELSE() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
53 SET(HG_REVISION |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
54 "${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
55 ENDIF() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 ENDIF() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
57 ENDIF() |