diff options
| author | Christoph Berg <myon@debian.org> | 2021-09-09 22:49:00 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2021-09-09 22:49:00 +0200 |
| commit | 85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 (patch) | |
| tree | 79807e00771e4af4ce279e368262f2222806102f /CMake/Modules/FindUsb.cmake | |
| parent | 2f095a04ed69d9aa14b47dc4acde6b3225b2d65e (diff) | |
New upstream version 2.5.0~rc6+repackupstream/2.5.0_rc6+repack
Diffstat (limited to 'CMake/Modules/FindUsb.cmake')
| -rw-r--r-- | CMake/Modules/FindUsb.cmake | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/CMake/Modules/FindUsb.cmake b/CMake/Modules/FindUsb.cmake new file mode 100644 index 00000000..9e76f244 --- /dev/null +++ b/CMake/Modules/FindUsb.cmake @@ -0,0 +1,49 @@ +# Findlibusb +# ========== +# +# Find the usb library +# +# This will define the following variables:: +# +# Usb_FOUND - True if the system has the usb library +# Usb_VERSION - The verion of the usb library which was found +# +# and the following imported targets:: +# +# Usb::Usb - The libusb library +# + +include (LibFindMacros) + +if (WIN32) + # Use path suffixes on MS Windows as we probably shouldn't + # trust the PATH envvar. PATH will still be searched to find the + # library as last resort. + if (CMAKE_SIZEOF_VOID_P MATCHES "8") + set (_library_options PATH_SUFFIXES MinGW64/dll MinGW64/static) + else () + set (_library_options PATH_SUFFIXES MinGW32/dll MinGW32/static) + endif () +endif () +libfind_pkg_detect (Usb usb-1.0 + FIND_PATH libusb.h PATH_SUFFIXES libusb-1.0 + FIND_LIBRARY usb-1.0 ${_library_options} + ) + +libfind_process (Usb) + +if (Usb_FOUND AND NOT TARGET Usb::Usb) + add_library (Usb::Usb UNKNOWN IMPORTED) + set_target_properties (Usb::Usb PROPERTIES + IMPORTED_LOCATION "${Usb_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Usb_PKGCONF_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Usb_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${Usb_LIBRARIES}" + ) +endif () + +mark_as_advanced ( + Usb_INCLUDE_DIR + Usb_LIBRARY + Usb_LIBRARIES + ) |
