1# - Try to find libftd2xx
2# Once done this will define
3#
4#  LIBFTD2XX_FOUND - system has libftd2xx
5#  LIBFTD2XX_INCLUDE_DIRS - the libftd2xx include directory
6#  LIBFTD2XX_LIBRARIES - Link these to use libftd2xx
7#  LIBFTD2XX_DEFINITIONS - Compiler switches required for using libftd2xx
8#
9#  Adapted from cmake-modules Google Code project
10#
11#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
12#
13#  (Changes for libftd2xx) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
14#
15# Redistribution and use is allowed according to the terms of the New BSD license.
16# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17
18if (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
19  # in cache already
20  set(LIBFTD2XX_FOUND TRUE)
21else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
22  find_path(LIBFTD2XX_INCLUDE_DIR
23    NAMES
24    ftd2xx.h
25    PATHS
26    /usr/include
27    /usr/local/include
28    /opt/local/include
29    /sw/include
30	)
31
32  SET(FTD2XX_LIBNAME ftd2xx)
33  IF(WIN32)
34	SET(FTD2XX_LIBNAME ftd2xx.lib)
35  ENDIF(WIN32)
36
37  find_library(LIBFTD2XX_LIBRARY
38    NAMES
39    ${FTD2XX_LIBNAME}
40    PATHS
41    /usr/lib
42    /usr/local/lib
43    /opt/local/lib
44    /sw/lib
45	)
46
47  if(LIBFTD2XX_INCLUDE_DIR)
48	set(LIBFTD2XX_INCLUDE_DIRS
49      ${LIBFTD2XX_INCLUDE_DIR}
50	  )
51  endif(LIBFTD2XX_INCLUDE_DIR)
52  set(LIBFTD2XX_LIBRARIES
53    ${LIBFTD2XX_LIBRARY}
54	)
55
56  if (LIBFTD2XX_INCLUDE_DIRS AND LIBFTD2XX_LIBRARIES)
57    set(LIBFTD2XX_FOUND TRUE)
58  endif (LIBFTD2XX_INCLUDE_DIRS AND LIBFTD2XX_LIBRARIES)
59
60  if (LIBFTD2XX_FOUND)
61    if (NOT libftd2xx_FIND_QUIETLY)
62	  message(STATUS "Found libftd2xx: ${LIBFTD2XX_LIBRARIES}")
63    endif (NOT libftd2xx_FIND_QUIETLY)
64  else (LIBFTD2XX_FOUND)
65    if (libftd2xx_FIND_REQUIRED)
66	  message(FATAL_ERROR "Could not find libftd2xx")
67    endif (libftd2xx_FIND_REQUIRED)
68  endif (LIBFTD2XX_FOUND)
69
70  # show the LIBFTD2XX_INCLUDE_DIRS and LIBFTD2XX_LIBRARIES variables only in the advanced view
71  mark_as_advanced(LIBFTD2XX_INCLUDE_DIRS LIBFTD2XX_LIBRARIES)
72
73endif (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
74