FindHIDAPI.cmake 672 B

123456789101112131415161718
  1. find_path(HIDAPI_INCLUDE_DIR NAMES hidapi.h PATH_SUFFIXES hidapi)
  2. find_library(HIDAPI_LIBRARY NAMES hidapi hidapi-hidraw hidapi-libusb)
  3. set(HIDAPI_LIBRARIES ${HIDAPI_LIBRARY})
  4. set(HIDAPI_INCLUDE_DIRS ${HIDAPI_INCLUDE_DIR})
  5. include(FindPackageHandleStandardArgs)
  6. find_package_handle_standard_args(HIDAPI DEFAULT_MSG HIDAPI_LIBRARY HIDAPI_INCLUDE_DIR)
  7. if(HIDAPI_FOUND AND NOT TARGET Hidapi::Hidapi)
  8. add_library(Hidapi::Hidapi UNKNOWN IMPORTED)
  9. set_target_properties(Hidapi::Hidapi PROPERTIES
  10. IMPORTED_LOCATION ${HIDAPI_LIBRARIES}
  11. INTERFACE_INCLUDE_DIRECTORIES ${HIDAPI_INCLUDE_DIRS}
  12. )
  13. endif()
  14. mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)