File: FindFTDI1.cmake

package info (click to toggle)
indi-bresserexos2 1.0%2B20221223130124-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 3,136 kB
  • sloc: cpp: 2,317; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,466 bytes parent folder | download | duplicates (113)
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
# - Try to find FTDI1
# Once done this will define
#
#  FTDI1_FOUND - system has FTDI
#  FTDI1_INCLUDE_DIR - the FTDI include directory
#  FTDI1_LIBRARIES - Link these to use FTDI
#
# N.B. You must include the file as following:
#
#include <libftdi1/ftdi.h>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)

  # in cache already
  set(FTDI1_FOUND TRUE)
  message(STATUS "Found libftdi1: ${FTDI1_LIBRARIES}")

else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)

  find_path(FTDI1_INCLUDE_DIR ftdi.h
    PATH_SUFFIXES libftdi1
    ${_obIncDir}
    ${GNUWIN32_DIR}/include
    /usr/local/include
  )

  find_library(FTDI1_LIBRARIES NAMES ftdi1
    PATHS
    ${_obLinkDir}
    ${GNUWIN32_DIR}/lib
    /usr/local/lib
  )

  if(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
    set(FTDI1_FOUND TRUE)
  else (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)
    set(FTDI1_FOUND FALSE)
  endif(FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)


  if (FTDI1_FOUND)
    if (NOT FTDI1_FIND_QUIETLY)
      message(STATUS "Found FTDI1: ${FTDI1_LIBRARIES}")
    endif (NOT FTDI1_FIND_QUIETLY)
  else (FTDI1_FOUND)
    if (FTDI1_FIND_REQUIRED)
      message(FATAL_ERROR "FTDI not found. Please install libftdi1-dev")
    endif (FTDI1_FIND_REQUIRED)
  endif (FTDI1_FOUND)

  mark_as_advanced(FTDI1_INCLUDE_DIR FTDI1_LIBRARIES)
  
endif (FTDI1_INCLUDE_DIR AND FTDI1_LIBRARIES)