7 # The module defines the following variables:
11 # GIT_EXECUTABLE - path to git command line client
12 # GIT_FOUND - true if the command line client was found
13 # GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
21 # message("git found: ${GIT_EXECUTABLE}")
24 #=============================================================================
25 # Copyright 2010 Kitware, Inc.
26 # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
28 # Distributed under the OSI-approved BSD License (the "License");
29 # see accompanying file Copyright.txt for details.
31 # This software is distributed WITHOUT ANY WARRANTY; without even the
32 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33 # See the License for more information.
34 #=============================================================================
35 # (To distribute this file outside of CMake, substitute the full
36 # License text for the above reference.)
38 # Look for 'git' or 'eg' (easy git)
42 # Prefer .cmd variants on Windows unless running in a Makefile
46 if(NOT CMAKE_GENERATOR MATCHES "MSYS")
47 set(git_names git.cmd git eg.cmd eg)
51 find_program(GIT_EXECUTABLE
53 PATH_SUFFIXES Git/cmd Git/bin
54 DOC "git command line client"
56 mark_as_advanced(GIT_EXECUTABLE)
59 execute_process(COMMAND ${GIT_EXECUTABLE} --version
60 OUTPUT_VARIABLE git_version
62 OUTPUT_STRIP_TRAILING_WHITESPACE)
63 if (git_version MATCHES "^git version [0-9]")
64 string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
69 # Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
70 # all listed variables are TRUE
72 include(FindPackageHandleStandardArgs)
73 find_package_handle_standard_args(Git GIT_EXECUTABLE