Restore change made by @jbeich made in rev 430669 accidentally removed.

N.B. the INCLUDE(CheckFunctionExists) is now needed here.
This commit is contained in:
Diane Bruce 2017-01-07 22:57:43 +00:00
parent be01232083
commit c32a854093
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=430843

View File

@ -1,54 +1,6 @@
--- cmake/Modules/FindUSB.cmake.orig 2016-09-02 04:16:12 UTC
+++ cmake/Modules/FindUSB.cmake
@@ -1,20 +1,32 @@
if(NOT LIBUSB_FOUND)
- pkg_check_modules (LIBUSB_PKG libusb-1.0)
- find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
- PATHS
- ${LIBUSB_PKG_INCLUDE_DIRS}
- /usr/include/libusb-1.0
- /usr/include
- /usr/local/include
- )
-
- find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb
- PATHS
- ${LIBUSB_PKG_LIBRARY_DIRS}
- /usr/lib
- /usr/local/lib
- )
+ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ message(status "--- Looking for FreeBSD usb")
+ set (LIBUSB_INCLUDE_DIR ${LOCALBASE}/include)
+ find_library(LIBUSB_LIBRARIES NAMES usb
+ PATHS
+ ${LIBUSB_PKG_LIBRARY_DIRS}
+ /usr/lib
+ )
+ else()
+ message(status "--- LIBUSB_LIBRARIES ${LIBUSB_LIBRARIES}")
+ pkg_check_modules (LIBUSB_PKG libusb-1.0)
+ find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
+ PATHS
+ ${LIBUSB_PKG_INCLUDE_DIRS}
+ /usr/include/libusb-1.0
+ /usr/include
+ /usr/local/include
+ )
+ find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb
+ PATHS
+ ${LIBUSB_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+ endif()
+message( status "--- LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR} LIBUSB_LIBRARIES ${LIBUSB_LIBRARIES}")
+
if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
@@ -22,6 +34,19 @@ else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRA
@@ -22,6 +22,19 @@ else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRA
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "libusb-1.0 not found.")
endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)