Hi!

Reviewboard failed to understand `git diff -M` patch, so I'm sending both 
the patch and the new FindUSB.cmake here.

Should I add OPTIONAL to include(FeatureSummary) until cmake-2.8.6 is not 
out?
-- 
Yury G. Kudryashov,
mailto: [email protected]
From: Yury G. Kudryashov <[email protected]>
Subject: [PATCH] Review FindUSB

* Warn developers about using legacy API
* Cache LIBUSB_LIBRARY instead of LIBUSB_LIBRARIES
* Add package URL and description

---
 {attic/modules => modules}/FindUSB.cmake |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/attic/modules/FindUSB.cmake b/modules/FindUSB.cmake
similarity index 52%
rename from attic/modules/FindUSB.cmake
rename to modules/FindUSB.cmake
index f0178a3..f268ef8 100644
--- a/attic/modules/FindUSB.cmake
+++ b/modules/FindUSB.cmake
@@ -6,25 +6,32 @@
 #  LIBUSB_LIBRARIES - Link these to use libusb
 
 # Copyright (c) 2006, 2008  Laurent Montel, <[email protected]>
+# Copyright (c) 2011 Yury Kudryashov, <[email protected]>
 #
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
 
-if (NOT WIN32)
-  # use pkg-config to get the directories and then use these values
-  # in the FIND_PATH() and FIND_LIBRARY() calls
-  find_package(PkgConfig)
-  pkg_check_modules(PC_LIBUSB QUIET libusb)
-endif(NOT WIN32)
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig)
+pkg_check_modules(PC_LIBUSB QUIET libusb)
+
+message(AUTHOR_WARNING "Consider switching from libusb-0.1 to libusb-1.0")
 
 find_path(LIBUSB_INCLUDE_DIR usb.h
   HINTS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
 
-find_library(LIBUSB_LIBRARIES NAMES usb
+find_library(LIBUSB_LIBRARY NAMES usb
   HINTS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
 
+set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY})
+
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(LIBUSB  DEFAULT_MSG  LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
 
-mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
+include(FeatureSummary)
+set_package_properties(USB PROPERTIES URL http://www.libusb.org/
+  DESCRIPTION "A library that provides uniform API to access USB devices on many OSes")
+
+mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY)
-- 
tg: (d46d5c4..) t/find-usb (depends on: master)

# - Try to find the freetype library
# Once done this defines
#
#  LIBUSB_FOUND - system has libusb
#  LIBUSB_INCLUDE_DIR - the libusb include directory
#  LIBUSB_LIBRARIES - Link these to use libusb

# Copyright (c) 2006, 2008  Laurent Montel, <[email protected]>
# Copyright (c) 2011 Yury Kudryashov, <[email protected]>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.


# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PC_LIBUSB QUIET libusb)

message(AUTHOR_WARNING "Consider switching from libusb-0.1 to libusb-1.0")

find_path(LIBUSB_INCLUDE_DIR usb.h
  HINTS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})

find_library(LIBUSB_LIBRARY NAMES usb
  HINTS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})

set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBUSB  DEFAULT_MSG  LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)

include(FeatureSummary)
set_package_properties(USB PROPERTIES URL http://www.libusb.org/
  DESCRIPTION "A library that provides uniform API to access USB devices on many OSes")

mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY)

_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to