From e149f4c4b0a90e15acd4226beb7334efbd22ce6a Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 31 Jul 2019 11:34:00 -0500 Subject: [PATCH] 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 | 4 +++- cmake/sdlchecks.cmake | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd59d89b2..ffa5cab34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1128,7 +1128,9 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID) endif() if(SDL_JOYSTICK) - CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? + if(FREEBSD OR NETBSD OR OPENBSD OR BSDI) + CheckUSBHID() + endif() CheckHIDAPI() if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 5d4d2f936..2df9e355b 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -1074,7 +1074,7 @@ macro(CheckHIDAPI) set(HAVE_HIDAPI FALSE) pkg_check_modules(LIBUSB libusb) if (LIBUSB_FOUND) - check_include_file(libusb.h HAVE_LIBUSB_H) + check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS}) if (HAVE_LIBUSB_H) set(HAVE_HIDAPI TRUE) endif()