dolphin/Externals/hidapi/CMakeLists.txt
Léo Lam 6036680376
hidapi: Use LIBUSB_LIBRARIES to link to libusb
Because we have an old-style find script that does not define a proper
CMake target for libusb, we need to use ${LIBUSB_LIBRARIES}
rather than "usb".

Ideally, we would fix the find script to define a target. However,
this issue breaks the fifoci-ogl-lin-mesa builder and I'd prefer it
to be fixed sooner rather than later.
2021-02-11 21:58:15 +01:00

21 lines
586 B
CMake

project(hidapi)
add_library(hidapi STATIC hidapi/hidapi.h)
target_include_directories(hidapi PUBLIC hidapi)
if(APPLE)
target_sources(hidapi PRIVATE mac/hid.c)
elseif(MSVC)
target_sources(hidapi PRIVATE windows/hid.c)
else()
find_package(Libudev)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND LIBUDEV_FOUND)
target_sources(hidapi PRIVATE linux/hid.c)
target_link_libraries(hidapi PRIVATE udev)
else()
target_sources(hidapi PRIVATE libusb/hid.c)
target_link_libraries(hidapi PRIVATE ${LIBUSB_LIBRARIES})
endif()
endif()
add_library(Hidapi::Hidapi ALIAS hidapi)