Merge pull request #5318 from ligfx/cmakehidapi
CMake: clean up HIDAPI build
This commit is contained in:
+3
-33
@@ -751,39 +751,9 @@ list(APPEND LIBS ${ICONV_LIBRARIES})
|
||||
|
||||
if(NOT ANDROID)
|
||||
find_package(HIDAPI)
|
||||
if(HIDAPI_FOUND)
|
||||
message(STATUS "Using shared ${HIDAPI_LIBRARIES} ${HIDAPI_VERSION}")
|
||||
include_directories(${HIDAPI_INCLUDE_DIRS})
|
||||
list(APPEND LIBS ${HIDAPI_LIBRARIES})
|
||||
else()
|
||||
set(HIDAPI_FOUND 1)
|
||||
include_directories(Externals/hidapi/hidapi)
|
||||
if(APPLE)
|
||||
message(STATUS "Using static hidapi from Externals")
|
||||
add_subdirectory(Externals/hidapi/mac)
|
||||
list(APPEND LIBS hidapi)
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
find_package(Libudev)
|
||||
if(LIBUDEV_FOUND)
|
||||
message(STATUS "Using static hidapi-hidraw from Externals")
|
||||
add_subdirectory(Externals/hidapi/linux)
|
||||
list(APPEND LIBS hidapi-hidraw udev)
|
||||
else()
|
||||
message(STATUS "Could not find udev, disabling hidapi")
|
||||
set(HIDAPI_FOUND 0)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
message(STATUS "Using static hidapi-hid from Externals")
|
||||
add_subdirectory(Externals/hidapi/windows)
|
||||
list(APPEND LIBS hidapi-hid)
|
||||
else()
|
||||
message(STATUS "Using static hidapi-libusb from Externals")
|
||||
add_subdirectory(Externals/hidapi/libusb)
|
||||
list(APPEND LIBS hidapi-libusb)
|
||||
endif()
|
||||
endif()
|
||||
if(HIDAPI_FOUND)
|
||||
add_definitions(-DHAVE_HIDAPI=1)
|
||||
if(NOT HIDAPI_FOUND)
|
||||
message(STATUS "Using static HIDAPI from Externals")
|
||||
add_subdirectory(Externals/hidapi EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user