From: Christoph Gysin <christoph.gysin@gmail.com> Date: Mon, 24 Jul 2017 17:22:15 +0000 (+0300) Subject: add CMake config (#20) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=usb-relay-hid.git add CMake config (#20) fixes #7 --- 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)