cmake: Fix locating libusb header at configure-time
authorAndrew Eikum <aeikum@codeweavers.com>
Wed, 31 Jul 2019 11:34:00 -0500
changeset 129712fbd3d8432ab
parent 12970 d482a01e159f
child 12972 c3c029a0b94b
cmake: Fix locating libusb header at configure-time

Removing the CheckUSBHID call is necessary to avoid caching the failed header
check result before we find libusb via pkg-config.
CMakeLists.txt
cmake/sdlchecks.cmake
     1.1 --- a/CMakeLists.txt	Wed Jul 31 19:40:50 2019 +0300
     1.2 +++ b/CMakeLists.txt	Wed Jul 31 11:34:00 2019 -0500
     1.3 @@ -1128,7 +1128,9 @@
     1.4    endif()
     1.5  
     1.6    if(SDL_JOYSTICK)
     1.7 -    CheckUSBHID()   # seems to be BSD specific - limit the test to BSD only?
     1.8 +    if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
     1.9 +      CheckUSBHID()
    1.10 +    endif()
    1.11      CheckHIDAPI()
    1.12      if(LINUX AND NOT ANDROID)
    1.13        set(SDL_JOYSTICK_LINUX 1)
     2.1 --- a/cmake/sdlchecks.cmake	Wed Jul 31 19:40:50 2019 +0300
     2.2 +++ b/cmake/sdlchecks.cmake	Wed Jul 31 11:34:00 2019 -0500
     2.3 @@ -1074,7 +1074,7 @@
     2.4        set(HAVE_HIDAPI FALSE)
     2.5        pkg_check_modules(LIBUSB libusb)
     2.6        if (LIBUSB_FOUND)
     2.7 -        check_include_file(libusb.h HAVE_LIBUSB_H)
     2.8 +        check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
     2.9          if (HAVE_LIBUSB_H)
    2.10            set(HAVE_HIDAPI TRUE)
    2.11          endif()