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.
This commit is contained in:
Alex James 2021-01-16 14:37:25 -06:00 committed by Ivan
parent d7a8d385d8
commit c06707c891

View File

@ -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()