Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

FindLibUSB-1.0.cmake 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Attempts to find libusb-1.0
  2. #
  3. # LIBUSB_FOUND - system has libusb
  4. # LIBUSB_INCLUDE_DIRS - the libusb include directory
  5. # LIBUSB_LIBRARIES - Link these to use libusb
  6. # LIBUSB_DEFINITIONS - Compiler switches required for using libusb
  7. #
  8. # Adapted from cmake-modules Google Code project
  9. #
  10. # Copyright (c) 2006 Andreas Schneider <[email protected]>
  11. #
  12. # (Changes for libusb) Copyright (c) 2014 Jacob Alexander <[email protected]>
  13. #
  14. # Redistribution and use is allowed according to the terms of the New BSD license.
  15. #
  16. # CMake-Modules Project New BSD License
  17. #
  18. # Redistribution and use in source and binary forms, with or without
  19. # modification, are permitted provided that the following conditions are met:
  20. #
  21. # * Redistributions of source code must retain the above copyright notice, this
  22. # list of conditions and the following disclaimer.
  23. #
  24. # * Redistributions in binary form must reproduce the above copyright notice,
  25. # this list of conditions and the following disclaimer in the
  26. # documentation and/or other materials provided with the distribution.
  27. #
  28. # * Neither the name of the CMake-Modules Project nor the names of its
  29. # contributors may be used to endorse or promote products derived from this
  30. # software without specific prior written permission.
  31. #
  32. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  33. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  34. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  35. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  36. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  37. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  38. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  39. # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  40. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  41. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  42. #
  43. if ( LIBUSB_LIBRARIES AND LIBUSB_INCLUDE_DIRS )
  44. # in cache already
  45. set( LIBUSB_FOUND TRUE )
  46. else ()
  47. find_path( LIBUSB_INCLUDE_DIR
  48. NAMES
  49. libusb.h
  50. PATHS
  51. /usr/include
  52. /usr/local/include
  53. /opt/local/include
  54. /sw/include
  55. /include
  56. PATH_SUFFIXES
  57. libusb-1.0
  58. )
  59. find_library( LIBUSB_LIBRARY
  60. NAMES
  61. usb-1.0
  62. PATHS
  63. /usr/lib
  64. /usr/local/lib
  65. /opt/local/lib
  66. /sw/lib
  67. /lib
  68. )
  69. set( LIBUSB_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIR} )
  70. set( LIBUSB_LIBRARIES ${LIBUSB_LIBRARY} )
  71. if ( LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES )
  72. set( LIBUSB_FOUND TRUE )
  73. endif ()
  74. if ( LIBUSB_FOUND )
  75. if ( NOT LIBUSB_FIND_QUIETLY )
  76. message( STATUS "Found libusb:" )
  77. message( STATUS " - Includes: ${LIBUSB_INCLUDE_DIRS}" )
  78. message( STATUS " - Libraries: ${LIBUSB_LIBRARIES}" )
  79. endif ()
  80. else ()
  81. if ( LIBUSB_FIND_REQUIRED )
  82. message( FATAL_ERROR "Could not find libusb-1.0" )
  83. endif ()
  84. endif ()
  85. # show the LIBUSB_INCLUDE_DIRS and LIBUSB_LIBRARIES variables only in the advanced view
  86. mark_as_advanced( LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES )
  87. endif ()