From 87cf2d92c7b64b02f870b86a55ee9c970c29abdd Mon Sep 17 00:00:00 2001 From: Christoph Gysin Date: Mon, 24 Jul 2017 20:22:15 +0300 Subject: [PATCH] add CMake config (#20) fixes #7 --- commandline/CMakeLists.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 commandline/CMakeLists.txt diff --git a/commandline/CMakeLists.txt b/commandline/CMakeLists.txt new file mode 100644 index 0000000..bb3383e --- /dev/null +++ b/commandline/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.0) +project(hidusb-relay) + +if(WIN32) + message("Building against hid") + set(SOURCES hiddata_mswin.c) + set(LIBRARIES hid setupapi) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL Darwin AND NOT USE_LIBUSB_ON_MACOS) + option(USE_LIBUSB_ON_MACOS "Use libusb instead of IOKit on MacOS" ON) + + set(SOURCES hiddata_osx.c) + set(LIBRARIES + "-framework CoreFoundation" + "-framework IOKit" + ) +else() + set(SOURCES hiddata_libusb01.c) + include(FindPkgConfig) + pkg_check_modules(LIBUSB REQUIRED libusb) + include_directories(${LIBUSB_INCLUDE_DIRS}) + set(LIBRARIES ${LIBUSB_LIBRARIES}) +endif() + +add_library(hidusb-relay SHARED ${SOURCES}) +target_link_libraries(hidusb-relay ${LIBRARIES}) + +add_executable(hidusb-relay-cmd usbrelay-cmd.c) +target_link_libraries(hidusb-relay-cmd hidusb-relay) -- 2.25.1