From c06707c891bd28938b0607d1027aaf7f85ed5990 Mon Sep 17 00:00:00 2001 From: Alex James Date: Sat, 16 Jan 2021 14:37:25 -0600 Subject: [PATCH] CMake: Unset LIBUSB_LIBRARIES when using libusb submodule If the system has libusb installed but USE_SYS_LIBUSB is false, the static libusb will link against the system libusb (as pkg_check_modules sets LIBUSB_LIBRARIES, and 3rdparty/libusb_cmake/libusb.cmake links the usb-1.0-static target with LIBUSB_LIBRARIES). Unset LIBUSB_LIBRARIES to avoid this when using the libusb submodule. --- 3rdparty/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 0a844c5c8b..e8d2b2ad01 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -131,6 +131,7 @@ else() target_link_libraries(usb-1.0-shared INTERFACE PkgConfig::LIBUSB) else() # we don't have the system libusb, so we compile from submodule + unset(LIBUSB_LIBRARIES CACHE) add_subdirectory(libusb_cmake EXCLUDE_FROM_ALL) endif() endif()