Skip to content

Commit

Permalink
Only use LIBUSB_LINK_LIBRARIES if it exists
Browse files Browse the repository at this point in the history
FindPkgConfig only sets <XXX>_LINK_LIBRARIES in CMake >= 3.12.

Signed-off-by: Clayton Smith <[email protected]>
Signed-off-by: Dimitri Stolnikov <[email protected]>
  • Loading branch information
argilo authored and Dimitri Stolnikov committed Dec 24, 2023
1 parent b85f037 commit af33886
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit af33886

Please sign in to comment.