From 4dc9b3fa6bd1b710c9ba7b535b6f75a6681f0fbc Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 18 Oct 2018 12:48:10 +0200 Subject: [PATCH] libusb: lookup libusb dynamically --- port/libusb/CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/port/libusb/CMakeLists.txt b/port/libusb/CMakeLists.txt index 0bdcb618a..9da43f079 100644 --- a/port/libusb/CMakeLists.txt +++ b/port/libusb/CMakeLists.txt @@ -1,14 +1,13 @@ cmake_minimum_required (VERSION 3.5) project(BTstack) -# add libusb - does not work with xcode -# find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0") -# find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib" "lib32" "lib64" "dylib") -# include_directories( ${LIBUSB_INCLUDE_DIR} ) -# add libusb - hard-coded, but works with Xcode, too -include_directories( /usr/local/include/libusb-1.0/ ) -link_libraries( usb-1.0) -link_directories(/usr/local/lib) +# add libusb +find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0") +find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib" "lib32" "lib64" "dylib") +get_filename_component(LIBUSB_LIBRARY_PATH ${LIBUSB_LIBRARY} DIRECTORY) +include_directories( ${LIBUSB_INCLUDE_DIR} ) +link_directories( ${LIBUSB_LIBRARY_PATH} ) +link_libraries( usb-1.0 ) include_directories(../../3rd-party/micro-ecc) include_directories(../../3rd-party/bluedroid/decoder/include)