Only use LIBUSB_LINK_LIBRARIES if it exists

FindPkgConfig only sets <XXX>_LINK_LIBRARIES in CMake >= 3.12.

Signed-off-by: Clayton Smith <argilo@gmail.com>
Signed-off-by: Dimitri Stolnikov <horiz0n@gmx.net>
This commit is contained in:
Clayton Smith 2023-12-23 20:14:53 -05:00 committed by Dimitri Stolnikov
parent b85f037d85
commit af33886796
1 changed files with 3 additions and 1 deletions

View File

@ -71,7 +71,9 @@ find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET)
set(LIBUSB_LIBRARIES "${LIBUSB_LINK_LIBRARIES}")
if(LIBUSB_LINK_LIBRARIES)
set(LIBUSB_LIBRARIES "${LIBUSB_LINK_LIBRARIES}")
endif()
else()
set(LIBUSB_LIBRARIES "" CACHE STRING "manual libusb path")
set(LIBUSB_INCLUDE_DIRS "" CACHE STRING "manual libusb includepath")