libftdi Archives

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

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Fabrice Fontaine <fontaine.fabrice@xxxxxxxxx>, Samuel Martin <s.martin49@xxxxxxxxx>
Date: Wed, 2 Oct 2019 09:46:28 +0200
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?!


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

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

Current Thread