libftdi Archives

Subject: Re: #include <libusb.h> vs #include <libusb-1.0/libusb.h>

From: Ryan Schmidt <libftdi@xxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 30 Jul 2020 05:26:04 -0500
On Jul 30, 2020, at 05:13, bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> 
> to my knowledge the accepted path to libusb.h for libusb1 is
> /usr/lib(xx)/libusb-1.0/libusb.h

Well, $PREFIX/include/libusb-1.0/libusb.h


> However ftdi.c only accesses via  #include <libusb.h>
> 
> cmake also emits an warning around libusb:
> 
> CMake Warning (dev) at 
> /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
>  The package name passed to `find_package_handle_standard_args` (LIBUSB)
>  does not match the name of the calling package (USB1).  This can lead to
>  problems in calling code that expects `find_package` result variables
>  (e.g., `_FOUND`) to follow a certain pattern.
> Call Stack (most recent call first):
>  cmake/FindUSB1.cmake:33 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
>  CMakeLists.txt:28 (find_package)
> 
> Does libftdi also work with libusb0? If not, I think it should be 
> #include <libusb-1.0/libusb.h>

I don't know about cmake, but that at least doesn't appear to be how pkg-config 
intends libusb to be used:

$ pkg-config --cflags libusb-1.0
-I/opt/local/include/libusb-1.0

So, -I/opt/local/include/libusb-1.0 is expected to be in CFLAGS, which means 
that when you #include a libusb-1.0 file, you would list the path to the file 
relative to /opt/local/include/libusb-1.0, in other words #include <libusb.h> 
is correct.



--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread