install(FILES ${CMAKE_BINARY_DIR}/libftdi1.pc ${CMAKE_BINARY_DIR}/libftdipp1.pc
DESTINATION lib${LIB_SUFFIX}/pkgconfig)
-if(${UNIX})
- configure_file(${CMAKE_SOURCE_DIR}/libftdi1-config.in ${CMAKE_BINARY_DIR}/libftdi1-config @ONLY)
- install(PROGRAMS ${CMAKE_BINARY_DIR}/libftdi1-config DESTINATION bin)
-endif(${UNIX})
+if ( UNIX )
+ configure_file ( libftdi1-config.in ${CMAKE_CURRENT_BINARY_DIR}/libftdi1-config @ONLY )
+ install ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libftdi1-config
+ DESTINATION bin )
+
+ get_target_property( _LIBFTDI_LIBRARY_LOCATION ftdi1 LOCATION )
+ get_filename_component ( _LIBFTDI_LIBRARY_NAME ${_LIBFTDI_LIBRARY_LOCATION} NAME )
+ set ( LIBFTDI_INCLUDE_DIR ${includedir} )
+ set ( LIBFTDI_INCLUDE_DIRS ${LIBFTDI_INCLUDE_DIR} )
+ set ( LIBFTDI_LIBRARY ${libdir}/${_LIBFTDI_LIBRARY_NAME} )
+ set ( LIBFTDI_LIBRARIES ${LIBFTDI_LIBRARY} )
+ list ( APPEND LIBFTDI_LIBRARIES ${LIBUSB_LIBRARIES} )
+ set ( LIBFTDI_ROOT_DIR ${prefix} )
+ set ( LIBFTDI_VERSION_STRING ${VERSION_STRING} )
+ set ( LIBFTDI_VERSION_MAJOR ${MAJOR_VERSION} )
+ set ( LIBFTDI_VERSION_MINOR ${MINOR_VERSION} )
+ set ( LIBFTDI_USE_FILE ${CMAKE_INSTALL_PREFIX}/lib/cmake/libftdi/UseLibFTDI.cmake )
+ configure_file ( LibFTDIConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibFTDIConfig.cmake @ONLY )
+ install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/LibFTDIConfig.cmake UseLibFTDI.cmake
+ DESTINATION lib/cmake/libftdi
+ )
+endif ()
include(CPack)
--- /dev/null
+# -*- cmake -*-
+#
+# LibFTDIConfig.cmake(.in)
+#
+# Copyright (C) 2013 Intra2net AG and the libftdi developers
+#
+# This file is part of LibFTDI.
+#
+# LibFTDI is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License
+# version 2.1 as published by the Free Software Foundation;
+#
+
+# Use the following variables to compile and link against LibFTDI:
+# LIBFTDI_FOUND - True if LibFTDI was found on your system
+# LIBFTDI_USE_FILE - The file making LibFTDI usable
+# LIBFTDI_DEFINITIONS - Definitions needed to build with LibFTDI
+# LIBFTDI_INCLUDE_DIRS - Directory where OT.hxx can be found
+# LIBFTDI_INCLUDE_DIRS - List of directories of LibFTDI and it's dependencies
+# LIBFTDI_LIBRARY - LibFTDI library location
+# LIBFTDI_LIBRARIES - List of libraries to link against
+# LIBFTDI_LIBRARY_DIRS - List of directories containing LibFTDI' libraries
+# LIBFTDI_ROOT_DIR - The base directory of LibFTDI
+# LIBFTDI_VERSION_STRING - A human-readable string containing the version
+# LIBFTDI_VERSION_MAJOR - The major version of LibFTDI
+# LIBFTDI_VERSION_MINOR - The minor version of LibFTDI
+# LIBFTDI_VERSION_PATCH - The patch version of LibFTDI
+# LIBFTDI_PYTHON_MODULE_PATH - Path to the python module
+
+set ( LIBFTDI_FOUND 1 )
+set ( LIBFTDI_USE_FILE "@LIBFTDI_USE_FILE@" )
+
+set ( LIBFTDI_DEFINITIONS "@LIBFTDI_DEFINITIONS@" )
+set ( LIBFTDI_INCLUDE_DIR "@LIBFTDI_INCLUDE_DIR@" )
+set ( LIBFTDI_INCLUDE_DIRS "@LIBFTDI_INCLUDE_DIRS@" )
+set ( LIBFTDI_LIBRARY "@LIBFTDI_LIBRARY@" )
+set ( LIBFTDI_LIBRARIES "@LIBFTDI_LIBRARIES@" )
+set ( LIBFTDI_LIBRARY_DIRS "@LIBFTDI_LIBRARY_DIRS@" )
+set ( LIBFTDI_ROOT_DIR "@LIBFTDI_ROOT_DIR@" )
+
+set ( LIBFTDI_VERSION_STRING "@LIBFTDI_VERSION_STRING@" )
+set ( LIBFTDI_VERSION_MAJOR "@LIBFTDI_VERSION_MAJOR@" )
+set ( LIBFTDI_VERSION_MINOR "@LIBFTDI_VERSION_MINOR@" )
+set ( LIBFTDI_VERSION_PATCH "@LIBFTDI_VERSION_PATCH@" )
+
+set ( LIBFTDI_PYTHON_MODULE_PATH "@LIBFTDI_PYTHON_MODULE_PATH@" )
+
--- /dev/null
+# -*- cmake -*-
+#
+# UseLibFTDI.cmake
+#
+# Copyright (C) 2013 Intra2net AG and the libftdi developers
+#
+# This file is part of LibFTDI.
+#
+# LibFTDI is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License
+# version 2.1 as published by the Free Software Foundation;
+#
+
+
+add_definitions ( ${LIBFTDI_DEFINITIONS} )
+include_directories ( ${LIBFTDI_INCLUDE_DIRS} )
+link_directories ( ${LIBFTDI_LIBRARY_DIRS} )
+
- message(STATUS "Building python bindings via swig. Will be installed under ${CMAKE_INSTALL_PREFIX}/${SITEPACKAGE}")
+ set ( LIBFTDI_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/${SITEPACKAGE} PARENT_SCOPE )
+ message(STATUS "Building python bindings via swig. Will be installed under ${LIBFTDI_PYTHON_MODULE_PATH}")
else(PYTHON_BINDINGS AND SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
message(STATUS "Not building python bindings")
endif(PYTHON_BINDINGS AND SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
--- /dev/null
+cmake_minimum_required ( VERSION 2.8 )
+
+project ( example C )
+
+find_package ( LibFTDI NO_MODULE REQUIRED )
+include ( ${LIBFTDI_USE_FILE} )
+
+add_executable ( example main.c )
+target_link_libraries( example ${LIBFTDI_LIBRARIES} )
+
+install ( TARGETS example
+ DESTINATION bin )
+
\ No newline at end of file
--- /dev/null
+/* main.c
+
+ Example for ftdi_new()
+
+ This program is distributed under the GPL, version 2
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ftdi.h>
+
+int main(void)
+{
+ struct ftdi_context *ftdi;
+ int retval = EXIT_SUCCESS;
+
+ if ((ftdi = ftdi_new()) == 0)
+ {
+ fprintf(stderr, "ftdi_new failed\n");
+ return EXIT_FAILURE;
+ }
+
+ return retval;
+}