-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindDFU.cmake
58 lines (47 loc) · 1.62 KB
/
FindDFU.cmake
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# - Try to find DFU
# Once done this will define
#
# DFU_FOUND - system has DFU
# DFU_INCLUDE_DIR - the DFU include directory
# DFU_LIBRARIES - Link these to use DFU
# DFU_VERSION_STRING - Human readable version number of dfu
# DFU_VERSION_MAJOR - Major version number of dfu
# DFU_VERSION_MINOR - Minor version number of dfu
# Copyright (c) 2017, Ilia Platone, <[email protected]>
# Based on FindLibfacile by Carsten Niehaus, <[email protected]>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (DFU_INCLUDE_DIR AND DFU_LIBRARIES)
# in cache already
set(DFU_FOUND TRUE)
message(STATUS "Found DFU: ${DFU_LIBRARIES}")
else (DFU_INCLUDE_DIR AND DFU_LIBRARIES)
find_path(DFU_INCLUDE_DIR dfu.h
PATH_SUFFIXES dfu
${_obIncDir}
${GNUWIN32_DIR}/include
)
find_library(DFU_LIBRARIES NAMES dfu
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
/usr/local/lib
HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
)
if(DFU_INCLUDE_DIR AND DFU_LIBRARIES)
set(DFU_FOUND TRUE)
else (DFU_INCLUDE_DIR AND DFU_LIBRARIES)
set(DFU_FOUND FALSE)
endif(DFU_INCLUDE_DIR AND DFU_LIBRARIES)
if (DFU_FOUND)
if (NOT DFU_FIND_QUIETLY)
message(STATUS "Found DFU: ${DFU_LIBRARIES}")
endif (NOT DFU_FIND_QUIETLY)
else (DFU_FOUND)
if (DFU_FIND_REQUIRED)
message(FATAL_ERROR "DFU not found. Please install libdfu-dev")
endif (DFU_FIND_REQUIRED)
endif (DFU_FOUND)
mark_as_advanced(DFU_LIBRARIES)
endif (DFU_INCLUDE_DIR AND DFU_LIBRARIES)