The branch, master has been updated
via 39042f17371589e295184e71b2c866f6bc0328aa (commit)
from 66f3167429f778b766abfa72445ee24dbb5d4da3 (commit)
- Log -----------------------------------------------------------------
commit 39042f17371589e295184e71b2c866f6bc0328aa
Author: Michel Zou <xantares09@xxxxxxxxxxx>
Date: Mon Jan 21 15:47:22 2013 +0100
Added cmake config file
-----------------------------------------------------------------------
Summary of changes:
CMakeLists.txt | 26 +++++++++++++++---
LibFTDIConfig.cmake.in | 47 +++++++++++++++++++++++++++++++++
UseLibFTDI.cmake | 18 ++++++++++++
bindings/CMakeLists.txt | 3 +-
examples/cmake_example/CMakeLists.txt | 13 +++++++++
examples/cmake_example/main.c | 24 +++++++++++++++++
6 files changed, 126 insertions(+), 5 deletions(-)
create mode 100644 LibFTDIConfig.cmake.in
create mode 100644 UseLibFTDI.cmake
create mode 100644 examples/cmake_example/CMakeLists.txt
create mode 100644 examples/cmake_example/main.c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e14961..445a38e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,9 +163,27 @@ configure_file(${CMAKE_SOURCE_DIR}/libftdipp1.pc.in
${CMAKE_BINARY_DIR}/libftdip
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)
diff --git a/LibFTDIConfig.cmake.in b/LibFTDIConfig.cmake.in
new file mode 100644
index 0000000..428518b
--- /dev/null
+++ b/LibFTDIConfig.cmake.in
@@ -0,0 +1,47 @@
+# -*- 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@" )
+
diff --git a/UseLibFTDI.cmake b/UseLibFTDI.cmake
new file mode 100644
index 0000000..e7e43b0
--- /dev/null
+++ b/UseLibFTDI.cmake
@@ -0,0 +1,18 @@
+# -*- 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} )
+
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index f177425..34de42d 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -54,7 +54,8 @@ if(PYTHON_BINDINGS AND SWIG_FOUND AND PYTHONLIBS_FOUND AND
PYTHONINTERP_FOUND)
- 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)
diff --git a/examples/cmake_example/CMakeLists.txt
b/examples/cmake_example/CMakeLists.txt
new file mode 100644
index 0000000..44bad3a
--- /dev/null
+++ b/examples/cmake_example/CMakeLists.txt
@@ -0,0 +1,13 @@
+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
diff --git a/examples/cmake_example/main.c b/examples/cmake_example/main.c
new file mode 100644
index 0000000..93b3a79
--- /dev/null
+++ b/examples/cmake_example/main.c
@@ -0,0 +1,24 @@
+/* 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;
+}
hooks/post-receive
--
A library to talk to FTDI chips
--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|