comparison cmake/FindHg.cmake @ 533:b8b3d922bf0d

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

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