Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a generated pkg-config file.

Signed-off-by: Kyle Machulis <kyle@nonpolynomial.com>
  • Loading branch information...
commit 7d48b4c7179e5a8fff1e2ba43fb62d65f15c47dd 1 parent c6ec850
@radarsat1 radarsat1 authored committed
Showing with 41 additions and 0 deletions.
  1. +32 −0 CMakeLists.txt
  2. +9 −0 libnifalcon.pc.cmake
View
32 CMakeLists.txt
@@ -139,3 +139,35 @@ SET(LIBNIFALCON_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/include")
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(examples)
+
+# pkg-config (use the CPack information)
+FIND_PACKAGE(PkgConfig)
+if(PKG_CONFIG_EXECUTABLE)
+ set(PC_SHORT_NAME "${NP_CPACK_NAME}")
+ set(PC_LONG_NAME "${NP_CPACK_NAME}")
+ set(PC_LIBRARY_NAME "${LIBNIFALCON_CPP}")
+ set(PC_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
+ set(PC_VERSION "${LIBNIFALCON_MAJOR_VERSION}.${LIBNIFALCON_MINOR_VERSION}.${LIBNIFALCON_BUILD_VERSION}")
+
+ if(LIBUSB_1_FOUND)
+ set(PC_REQUIRES "${PC_REQUIRES}libusb-1.0 ")
+ endif(LIBUSB_1_FOUND)
+ if(LIBFTDI_FOUND)
+ set(PC_REQUIRES "${PC_REQUIRES}libftdi ")
+ endif(LIBFTDI_FOUND)
+
+ set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
+ set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
+ set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
+ set(PC_CONFIGURED_FILE
+ ${CMAKE_BINARY_DIR}/libnifalcon.pc
+ )
+ MESSAGE("-- Generating ${PC_CONFIGURED_FILE}")
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/libnifalcon.pc.cmake
+ ${PC_CONFIGURED_FILE}
+ @ONLY
+ )
+ set(PKG_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+ install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
+endif(PKG_CONFIG_EXECUTABLE)
View
9 libnifalcon.pc.cmake
@@ -0,0 +1,9 @@
+libdir=@CMAKE_INSTALL_PREFIX@/lib
+includedir=@CMAKE_INSTALL_PREFIX@/include
+
+Name: @PC_SHORT_NAME@
+Description: @PC_LONG_NAME@: @PC_DESCRIPTION@
+Requires: @PC_REQUIRES@
+Version: @PC_VERSION@
+Libs: -L${libdir} @PC_LINK_FLAGS@
+Cflags: -I${includedir} @PC_COMPILE_FLAGS@
Please sign in to comment.
Something went wrong with that request. Please try again.