Commit | Line | Data |
---|---|---|
87cf2d92 CG |
1 | cmake_minimum_required(VERSION 3.0) |
2 | project(hidusb-relay) | |
3 | ||
4 | if(WIN32) | |
5 | message("Building against hid") | |
6 | set(SOURCES hiddata_mswin.c) | |
7 | set(LIBRARIES hid setupapi) | |
8 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL Darwin AND NOT USE_LIBUSB_ON_MACOS) | |
9 | option(USE_LIBUSB_ON_MACOS "Use libusb instead of IOKit on MacOS" ON) | |
10 | ||
11 | set(SOURCES hiddata_osx.c) | |
12 | set(LIBRARIES | |
13 | "-framework CoreFoundation" | |
14 | "-framework IOKit" | |
15 | ) | |
16 | else() | |
17 | set(SOURCES hiddata_libusb01.c) | |
18 | include(FindPkgConfig) | |
19 | pkg_check_modules(LIBUSB REQUIRED libusb) | |
20 | include_directories(${LIBUSB_INCLUDE_DIRS}) | |
21 | set(LIBRARIES ${LIBUSB_LIBRARIES}) | |
22 | endif() | |
23 | ||
24 | add_library(hidusb-relay SHARED ${SOURCES}) | |
25 | target_link_libraries(hidusb-relay ${LIBRARIES}) | |
26 | ||
27 | add_executable(hidusb-relay-cmd usbrelay-cmd.c) | |
28 | target_link_libraries(hidusb-relay-cmd hidusb-relay) |