mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-20 15:51:07 +01:00
Fix dynamic library handling for LibUSB
`target_get_dynamic_library` should not be called if `SDL_HIDAPI_LIBUSB_SHARED` is set to OFF, it otherwise causes a warning at best, or a build failure if libusb is provided by a parent project and not installed on the system
This commit is contained in:
committed by
Sam Lantinga
parent
f472f93db8
commit
4a29b6a651
@@ -1270,12 +1270,15 @@ macro(CheckHIDAPI)
|
||||
cmake_pop_check_state()
|
||||
if(HAVE_LIBUSB_H)
|
||||
set(HAVE_LIBUSB TRUE)
|
||||
target_get_dynamic_library(dynamic_libusb LibUSB::LibUSB)
|
||||
if(SDL_HIDAPI_LIBUSB_SHARED AND dynamic_libusb)
|
||||
set(HAVE_HIDAPI_LIBUSB_SHARED ON)
|
||||
set(SDL_LIBUSB_DYNAMIC "\"${dynamic_libusb}\"")
|
||||
sdl_link_dependency(hidapi INCLUDES $<TARGET_PROPERTY:LibUSB::LibUSB,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
else()
|
||||
if(SDL_HIDAPI_LIBUSB_SHARED)
|
||||
target_get_dynamic_library(dynamic_libusb LibUSB::LibUSB)
|
||||
if(dynamic_libusb)
|
||||
set(HAVE_HIDAPI_LIBUSB_SHARED ON)
|
||||
set(SDL_LIBUSB_DYNAMIC "\"${dynamic_libusb}\"")
|
||||
sdl_link_dependency(hidapi INCLUDES $<TARGET_PROPERTY:LibUSB::LibUSB,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_HIDAPI_LIBUSB_SHARED)
|
||||
sdl_link_dependency(hidapi LIBS LibUSB::LibUSB PKG_CONFIG_SPECS "${LibUSB_PKG_CONFIG_SPEC}" CMAKE_MODULE LibUSB)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user