File: FindPatcher.cmake

package info (click to toggle)
bladerf 0.2022.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 373,752 kB
  • sloc: ansic: 1,186,428; xml: 150,799; vhdl: 24,182; tcl: 15,408; python: 3,409; sh: 1,551; makefile: 1,255; asm: 158; csh: 18; cpp: 9
file content (42 lines) | stat: -rw-r--r-- 1,079 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
if(DEFINED __INCLUDED_BLADERF_FIND_PATCHER)
    return()
endif()
set(__INCLUDED_BLADERF_FIND_PATCHER TRUE)

# Look for the packages we want
find_package(Patch QUIET)
find_package(Git QUIET)

# Work around cross-platform case sensitivity issues
if(PATCH_FOUND)
    set(Patch_FOUND ${PATCH_FOUND})
    if (PATCH_EXECUTABLE)
        set(Patch_EXECUTABLE ${PATCH_EXECUTABLE})
    endif()
endif()

if(GIT_FOUND)
    set(Git_FOUND ${GIT_FOUND})
    if (GIT_EXECUTABLE)
        set(Git_EXECUTABLE ${GIT_EXECUTABLE})
    endif()
endif()

# patch is preferred, but git-apply is also okay.
if(Patch_FOUND)
    set(Patcher_FOUND TRUE)
    set(Patcher_EXECUTABLE ${Patch_EXECUTABLE})
elseif(Git_FOUND)
    set(Patcher_FOUND TRUE)
    set(Patcher_EXECUTABLE ${Git_EXECUTABLE};--bare;apply;-)
else()
    set(Patcher_FOUND FALSE)
endif()

if(NOT Patcher_FOUND AND Patcher_FIND_REQUIRED)
    message(FATAL_ERROR "FindPatcher: Could not find either 'patch' or 'git'!")
endif()

if(Patcher_FOUND AND NOT Patcher_FIND_QUIETLY)
    message(STATUS "FindPatcher: found ${Patcher_EXECUTABLE}")
endif()