Commit 19b13aab98ef02c93ed356af639d1e4ed0254906

Anonymous Maarten 2022-09-10T13:41:29

cmake: mark hidapi as disabled when not found

diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 80f31c7..b220d33 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -1201,6 +1201,9 @@ macro(CheckHIDAPI)
       if(HIDAPI_ONLY_LIBUSB AND NOT HAVE_LIBUSB)
         set(HAVE_HIDAPI FALSE)
       endif()
+      if(NOT HAVE_LIBUSB)
+        set(HAVE_HIDAPI_LIBUSB FALSE)
+      endif()
     endif()
 
     if(HAVE_HIDAPI)
@@ -1220,6 +1223,8 @@ macro(CheckHIDAPI)
         file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c)
         list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES})
       endif()
+    else()
+      set(SDL_HIDAPI_DISABLED 0)
     endif()
   else()
     set(SDL_HIDAPI_DISABLED 1)