Use pkg-config to retrieve libusb dependencies such as -latomic and avoid the following static build failure:
/nvmedata/autobuild/instance-29/output-1/per-package/libftdi1/host/bin/../lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /nvmedata/autobuild/instance-29/output-1/per-package/libftdi1/host/sparc-buildroot-linux-uclibc/sysroot/lib/libusb-1.0.a(core.o): in function `libusb_unref_device': /nvmedata/autobuild/instance-29/output-1/build/libusb-1.0.25/libusb/core.c:1186: undefined reference to `__atomic_fetch_add_4' Fixes: - http://autobuild.buildroot.org/results/1ca7cd85ae60ad4797a6d8a83b2fb51d7eab96d9 Signed-off-by: Fabrice Fontaine <fontaine.fabr...@gmail.com> --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b0b87c..b7010ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,16 @@ if(${CMAKE_BUILD_TYPE} STREQUAL Debug) endif(${CMAKE_BUILD_TYPE} STREQUAL Debug) # find libusb -find_package ( USB1 REQUIRED ) -include_directories ( ${LIBUSB_INCLUDE_DIR} ) +find_package( PkgConfig ) +if (PkgConfig_FOUND) + pkg_check_modules( LIBUSB libusb-1.0 ) + if (LIBUSB_FOUND) + include_directories ( ${LIBUSB_INCLUDE_DIRS} ) + else() + find_package ( USB1 REQUIRED ) + include_directories ( ${LIBUSB_INCLUDE_DIR} ) + endif() +endif() # Find Boost if (FTDIPP OR BUILD_TESTS) -- 2.35.1 -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to libftdi+unsubscr...@developer.intra2net.com