commit 37acba5db2f808b4bb9ad7ffb909422b1e815d93
Author: Mattia Verga <mattia.verga@tiscali.it>
Date:   Mon Oct 13 19:28:05 2025 +0200

    Allow using hidapi from system (#1194)
    
    Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,16 @@ find_package(USB1 REQUIRED)
 find_package(INDI REQUIRED)
 find_package(Threads REQUIRED)
 
+if(INDI_HIDAPILIB)
+    set(HIDAPILIB "")
+    message(STATUS "Using indi bundled hid library")
+else(INDI_HIDAPILIB)
+    find_package(hidapi REQUIRED)
+    add_definitions(-D_USE_SYSTEM_HIDAPILIB)
+    set(HIDAPILIB hidapi::libusb)
+    message(STATUS "Using system provided hid library")
+endif(INDI_HIDAPILIB)
+
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(${INDI_INCLUDE_DIR})
@@ -62,14 +72,14 @@ target_link_libraries(indi_sx_ccd ${INDI_LIBRARIES} ${USB1_LIBRARIES})
 add_executable(indi_sx_wheel ${CMAKE_CURRENT_SOURCE_DIR}/sxwheel.cpp)
 IF (APPLE)
 set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
-target_link_libraries(indi_sx_wheel ${INDI_LIBRARIES} ${LIBUSB_LIBRARIES})
+target_link_libraries(indi_sx_wheel ${INDI_LIBRARIES} ${LIBUSB_LIBRARIES} ${HIDAPILIB})
 ELSEIF (WIN32)
 ELSE ()
-target_link_libraries(indi_sx_wheel ${INDI_LIBRARIES} ${USB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(indi_sx_wheel ${INDI_LIBRARIES} ${USB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${HIDAPILIB})
 ENDIF()
 
 if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
-target_link_libraries(indi_sx_wheel rt)
+target_link_libraries(indi_sx_wheel rt ${HIDAPILIB})
 endif (CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
 
 set(indisxao_SRCS
--- a/sxwheel.h
+++ b/sxwheel.h
@@ -31,7 +31,11 @@
 #include <indifilterwheel.h>
 #include <indipropertyswitch.h>
 
-#include <hidapi.h>
+#ifdef _USE_SYSTEM_HIDAPILIB
+#include <hidapi/hidapi.h>
+#else
+#include <indi_hidapi.h>
+#endif
 
 class SXWHEEL : public INDI::FilterWheel
 {
