From 4b6c779a35a19c9494e5b6894c14d198c535705c Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Sat, 12 Dec 2020 10:05:00 +0100 Subject: [PATCH] Only link libusb if sixpair is to be used (Fixes #406) --- src/utils/CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 95ee0a96..3f5c0481 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -10,13 +10,15 @@ target_link_libraries(psmove psmoveapi) set_property(TARGET psmove PROPERTY FOLDER "Utilities") list(APPEND PSMOVEAPI_INSTALL_TARGETS psmove) -if (WIN32) - include(${CMAKE_CURRENT_LIST_DIR}/libusb.cmake) - target_link_libraries(psmove ${LIBUSB_LIBRARIES}) -else() - # sixpair needs libusb - find_package(PkgConfig REQUIRED) - pkg_check_modules(LIBUSB REQUIRED libusb) - include_directories(${LIBUSB_INCLUDE_DIRS}) - target_link_libraries(psmove ${LIBUSB_LIBRARIES}) +if(PSMOVE_USE_SIXPAIR) + if (WIN32) + include(${CMAKE_CURRENT_LIST_DIR}/libusb.cmake) + target_link_libraries(psmove ${LIBUSB_LIBRARIES}) + else() + # sixpair needs libusb + find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBUSB REQUIRED libusb) + include_directories(${LIBUSB_INCLUDE_DIRS}) + target_link_libraries(psmove ${LIBUSB_LIBRARIES}) + endif() endif()