libftdi Archives

Subject: Re: [PATCH 1/1] cmake: fix FindUSB1.cmake

From: Fabrice Fontaine <fontaine.fabrice@xxxxxxxxx>
To: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Cc: libftdi@xxxxxxxxxxxxxxxxxxxxxxx, Samuel Martin <s.martin49@xxxxxxxxx>
Date: Wed, 2 Oct 2019 13:42:10 +0200
Dear Thomas,

Le mer. 2 oct. 2019 à 09:46, Thomas Jarosch
<thomas.jarosch@xxxxxxxxxxxxx> a écrit :
>
> Hi Fabrice and Samuel,
>
> You wrote on Tue, Oct 01, 2019 at 06:54:44PM +0200:
> > Make sure all ldflags are correctly set, especially for static build.
> >
> > Signed-off-by: Samuel Martin <s.martin49@xxxxxxxxx>
> > [Retrieved from:
> > https://git.buildroot.net/buildroot/tree/package/libftdi1/0002-cmake-fix-FindUSB1.cmake.patch]
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@xxxxxxxxx>
> > ---
> >  cmake/FindUSB1.cmake | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/cmake/FindUSB1.cmake b/cmake/FindUSB1.cmake
> > index b90e297..e7f1b3c 100644
> > --- a/cmake/FindUSB1.cmake
> > +++ b/cmake/FindUSB1.cmake
> > @@ -26,8 +26,12 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
> >      PATH_SUFFIXES libusb-1.0
> >      PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
> >
> > -  FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0
> > -    PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
> > +  set(LIBUSB_LIBRARIES ${PC_LIBUSB_STATIC_LDFLAGS} 
> > ${PC_LIBUSB_STATIC_LDFLAGS_OTHER})
> > +  foreach(libname ${PC_LIBUSB_STATIC_LIBRARIES})
> > +    FIND_LIBRARY(lib NAMES ${libname}
> > +      PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
> > +    list(APPEND LIBUSB_LIBRARIES ${lib})
> > +  endforeach()
>
> I'm unsure about this one: If there is no static build of libusb available,
> would it even still work? Otherwise I imagine the pkgconfig output is empty?!
I assume that PC_LIBUSB_STATIC_xxx variables are set even when libusb
is built dynamically as we have this patch since 4 years in buildroot
and this has not raise any autobuilder failures.
However, I also found out that this patch is not needed anymore.
Indeed, the only optional dependency of libusb is udev.
But buildroot does not allow libusb to be built with udev on static
build anymore.
So this patch can be dropped from buildroot.
Thanks for your feedback, I'll try to send the two remaining patches
that we have on buildroot. It would be nice to get them in the
upcoming 1.5 (or drop them).
>
>
> This is the previous cmake output:
> -- Found LIBUSB: /usr/lib64/libusb-1.0.so
>
> Here's the output with the patch:
> -- Found LIBUSB: 
> -lusb-1.0;-ludev;-pthread;-pthread;/usr/lib64/libusb-1.0.so;/usr/lib64/libusb-1.0.so
>
>
> As you can see, the previous detection uses an explicit path while the new
> "-lusb-1.0" will search the directories given to the linker via 
> "-Lxxxx,-Lyyyyy" and
> then has an explicit path given at the end of the list?
>
> Cheers,
> Thomas

Best Regards,

Fabrice

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

Current Thread