1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
10 The module defines the following variables:
13 Path to patch command-line executable.
15 True if the patch command-line executable was found.
17 The following :prop_tgt:`IMPORTED` targets are also defined:
20 The command-line executable.
28 message("Patch found: ${Patch_EXECUTABLE}")
30 #]=======================================================================]
32 set(_doc "Patch command line executable")
37 "$ENV{LOCALAPPDATA}/Programs/Git/bin"
38 "$ENV{LOCALAPPDATA}/Programs/Git/usr/bin"
39 "$ENV{APPDATA}/Programs/Git/bin"
40 "$ENV{APPDATA}/Programs/Git/usr/bin"
44 # First search the PATH
45 find_program(Patch_EXECUTABLE
52 # Now look for installations in Git/ directories under typical installation
53 # prefixes on Windows.
54 find_program(Patch_EXECUTABLE
56 PATH_SUFFIXES Git/usr/bin Git/bin GnuWin32/bin
61 if(Patch_EXECUTABLE AND NOT TARGET Patch::patch)
62 add_executable(Patch::patch IMPORTED)
63 set_property(TARGET Patch::patch PROPERTY IMPORTED_LOCATION ${Patch_EXECUTABLE})
69 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
70 find_package_handle_standard_args(Patch
71 REQUIRED_VARS Patch_EXECUTABLE)