forked from matrix-io/xc3sprog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Findlibftdi.cmake
68 lines (56 loc) · 1.79 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
61
62
63
64
65
66
67
68
# Copyright 2009 SoftPLC Corporation http://softplc.com
# Dick Hollenbeck <d...@softplc.com>
# 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)
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
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)
if(USE_STATIC_FTDI)
add_library(libftdi STATIC IMPORTED)
else(USE_STATIC_FTDI)
add_library(libftdi SHARED IMPORTED)
endif(USE_STATIC_FTDI)
set_target_properties(libftdi PROPERTIES IMPORTED_LOCATION ${LIBFTDI_LIBRARIES})
set(${LIBFTDI_LIBRARIES} libftdi)
#mark_as_advanced(LIBFTDI_INCLUDE_DIR LIBFTDI_LIBRARIES)
endif(NOT LIBFTDI_FOUND)