-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindlibftdi.cmake
60 lines (51 loc) · 1.54 KB
/
Findlibftdi.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
59
60
# Copyright 2009 SoftPLC Corporation http://softplc.com
# Dick Hollenbeck <[email protected]>
# License: GPL v2
#
# - Try to find libftdi
#
# Before calling, USE_STATIC_FTDI may be set to mandate a STATIC library
#
# Once done this will define
#
# LIBFTDI_FOUND - system has libftdi
# LIBFTDI_INCLUDE_DIR - the libftdi include directory
# LIBFTDI_LIBRARIES - Link these to use libftdi
if (NOT LIBFTDI_FOUND)
if(NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(LIBFTDI_PKG libftdi)
if(NOT LIBFTI_FOUND)
pkg_check_modules(LIBFTDI_PKG libftdi1)
endif()
endif(NOT WIN32)
find_path(LIBFTDI_INCLUDE_DIR
NAMES
ftdi.h
HINTS
${LIBFTDI_PKG_INCLUDE_DIRS}
PATHS
/usr/include
/usr/local/include
)
if(USE_STATIC_FTDI)
set(_save ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif(USE_STATIC_FTDI)
find_library(LIBFTDI_LIBRARIES
NAMES
ftdi ftdi1
HINTS
${LIBFTDI_PKG_LIBRARY_DIRS}
PATHS
/usr/lib
/usr/local/lib
)
if(USE_STATIC_FTDI)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_save} )
endif(USE_STATIC_FTDI)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY AND REQUIRED arguments AND set LIBFTDI_FOUND to TRUE if
# all listed variables are TRUE
find_package_handle_standard_args(LIBFTDI DEFAULT_MSG LIBFTDI_LIBRARIES LIBFTDI_INCLUDE_DIR)
endif(NOT LIBFTDI_FOUND)