cmake: check linkage to libusb too, instead of libusb.h presence only.
avoids false positives when using a cross-toolchain file
This commit is contained in:
committed by
Anonymous Maarten
parent
041dbd6b5f
commit
f617918e0a
@@ -1029,7 +1029,14 @@ macro(CheckHIDAPI)
|
|||||||
if(PC_LIBUSB_FOUND)
|
if(PC_LIBUSB_FOUND)
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${PC_LIBUSB_INCLUDE_DIRS})
|
list(APPEND CMAKE_REQUIRED_INCLUDES ${PC_LIBUSB_INCLUDE_DIRS})
|
||||||
check_include_file(libusb.h HAVE_LIBUSB_H)
|
list(APPEND CMAKE_REQUIRED_LIBRARIES PkgConfig::PC_LIBUSB)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <libusb.h>
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
libusb_close(NULL);
|
||||||
|
return 0;
|
||||||
|
}" HAVE_LIBUSB_H)
|
||||||
cmake_pop_check_state()
|
cmake_pop_check_state()
|
||||||
if(HAVE_LIBUSB_H)
|
if(HAVE_LIBUSB_H)
|
||||||
set(HAVE_LIBUSB TRUE)
|
set(HAVE_LIBUSB TRUE)
|
||||||
|
|||||||
Reference in New Issue
Block a user