Mercurial > trustbridge
annotate cmake/FindHg.cmake @ 1163:e3772d2810b3
Fix tests now that portpath includes logging
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 18 Sep 2014 18:53:56 +0200 |
parents | a2998ae79436 |
children |
rev | line source |
---|---|
533
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 # The module defines the following variables: |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
2 # HG_EXECUTABLE - path to mercurial command line client (hg) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 # HG_FOUND - true if the command line client was found |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
4 # HG_VERSION_STRING - the version of mercurial found |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
5 # Example usage: |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
6 # find_package(Hg) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
7 # if(HG_FOUND) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
8 # message("hg found: ${HG_EXECUTABLE}") |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 # endif() |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 #============================================================================= |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 # Copyright 2010-2012 Kitware, Inc. |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de> |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 # |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 # Distributed under the OSI-approved BSD License (the "License"); |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 # see accompanying file Copyright.txt for details. |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 # |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 # This software is distributed WITHOUT ANY WARRANTY; without even the |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
20 # See the License for more information. |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
21 #============================================================================= |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 # (To distribute this file outside of CMake, substitute the full |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 # License text for the above reference.) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 find_program(HG_EXECUTABLE |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 NAMES hg |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 PATH_SUFFIXES Mercurial |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 DOC "hg command line client" |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 ) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
30 mark_as_advanced(HG_EXECUTABLE) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
32 if(HG_EXECUTABLE) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
33 execute_process(COMMAND ${HG_EXECUTABLE} --version |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
34 OUTPUT_VARIABLE hg_version |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
35 ERROR_QUIET |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
36 OUTPUT_STRIP_TRAILING_WHITESPACE) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
37 if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)") |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
38 set(HG_VERSION_STRING "${CMAKE_MATCH_1}") |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
39 endif() |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
40 unset(hg_version) |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
41 endif() |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
42 |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
43 # Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 # all listed variables are TRUE |
535
a2998ae79436
Fix findHg to work from the repo
Andre Heinecke <aheinecke@intevation.de>
parents:
533
diff
changeset
|
45 include(FindPackageHandleStandardArgs) |
533
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 find_package_handle_standard_args(Hg |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 REQUIRED_VARS HG_EXECUTABLE |
b8b3d922bf0d
Add FindHg from cmake 2.8.12
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
48 VERSION_VAR HG_VERSION_STRING) |