Procházet zdrojové kódy

cmake: Fix header detection with CheckUSBHID

Make use of check_include_files to be able to also include
stdint.h when checking for the headers. Fixes detection of
usbhid.h on OpenBSD.

/usr/include/usbhid.h:40:2: error: unknown type name 'uint32_t'
   40 |         uint32_t _usage_page;
      |         ^

(cherry picked from commit 410a35fbee9c2211f6d824c2d65b44d22009212d)
Brad Smith před 1 měsícem
rodič
revize
0c7042477a
2 změnil soubory, kde provedl 5 přidání a 4 odebrání
  1. 1 0
      CMakeLists.txt
  2. 4 4
      cmake/sdlchecks.cmake

+ 1 - 0
CMakeLists.txt

@@ -60,6 +60,7 @@ endif()
 include(CheckLibraryExists)
 include(CheckLibraryExists)
 include(CheckIncludeFiles)
 include(CheckIncludeFiles)
 include(CheckIncludeFile)
 include(CheckIncludeFile)
+include(CheckIncludeFiles)
 include(CheckLanguage)
 include(CheckLanguage)
 include(CheckSymbolExists)
 include(CheckSymbolExists)
 include(CheckCSourceCompiles)
 include(CheckCSourceCompiles)

+ 4 - 4
cmake/sdlchecks.cmake

@@ -1089,22 +1089,22 @@ endmacro()
 macro(CheckUSBHID)
 macro(CheckUSBHID)
   check_library_exists(usbhid hid_init "" LIBUSBHID)
   check_library_exists(usbhid hid_init "" LIBUSBHID)
   if(LIBUSBHID)
   if(LIBUSBHID)
-    check_include_file(usbhid.h HAVE_USBHID_H)
+    check_include_files("stdint.h;usbhid.h" HAVE_USBHID_H)
     if(HAVE_USBHID_H)
     if(HAVE_USBHID_H)
       set(USB_CFLAGS "-DHAVE_USBHID_H")
       set(USB_CFLAGS "-DHAVE_USBHID_H")
     endif()
     endif()
 
 
-    check_include_file(libusbhid.h HAVE_LIBUSBHID_H)
+    check_include_files("stdint.h;libusbhid.h" HAVE_LIBUSBHID_H)
     if(HAVE_LIBUSBHID_H)
     if(HAVE_LIBUSBHID_H)
       set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSBHID_H")
       set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSBHID_H")
     endif()
     endif()
     set(USB_LIBS ${USB_LIBS} usbhid)
     set(USB_LIBS ${USB_LIBS} usbhid)
   else()
   else()
-    check_include_file(usb.h HAVE_USB_H)
+    check_include_files("stdint.h;usb.h" HAVE_USB_H)
     if(HAVE_USB_H)
     if(HAVE_USB_H)
       set(USB_CFLAGS "-DHAVE_USB_H")
       set(USB_CFLAGS "-DHAVE_USB_H")
     endif()
     endif()
-    check_include_file(libusb.h HAVE_LIBUSB_H)
+    check_include_files("stdint.h;libusb.h" HAVE_LIBUSB_H)
     if(HAVE_LIBUSB_H)
     if(HAVE_LIBUSB_H)
       set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSB_H")
       set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSB_H")
     endif()
     endif()