diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindCcache.cmake | 2 | ||||
-rw-r--r-- | cmake/FindHIDAPI.cmake | 13 | ||||
-rw-r--r-- | cmake/FindLibUSB.cmake | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake index 2eb2fa2fd..d98518134 100644 --- a/cmake/FindCcache.cmake +++ b/cmake/FindCcache.cmake @@ -50,7 +50,7 @@ option (CCACHE "") file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }") set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}") set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}") -add_executable(test test.cpp) +add_executable(main test.cpp) ]=]) try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}") unset(TEST_PROJECT) diff --git a/cmake/FindHIDAPI.cmake b/cmake/FindHIDAPI.cmake index 9b45dcc4c..f56bab482 100644 --- a/cmake/FindHIDAPI.cmake +++ b/cmake/FindHIDAPI.cmake @@ -39,19 +39,28 @@ find_package_handle_standard_args(HIDAPI if(HIDAPI_FOUND) set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}") - if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux")) + if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux") OR ANDROID) find_library(LIBUSB-1.0_LIBRARY usb-1.0) find_library(LIBUDEV_LIBRARY udev) if(LIBUSB-1.0_LIBRARY) set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUSB-1.0_LIBRARY}") if(LIBUDEV_LIBRARY) set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${LIBUDEV_LIBRARY}") - else() + elseif(NOT ANDROID) message(WARNING "libudev library not found, binaries may fail to link.") endif() else() message(WARNING "libusb-1.0 library not found, binaries may fail to link.") endif() + if(ANDROID) + # libusb uses android log library + find_library(ANDROID_LOG_LIBRARY log) + if(ANDROID_LOG_LIBRARY) + set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARIES};${ANDROID_LOG_LIBRARY}") + else() + message(WARNING "Android log library not found, binaries may fail to link.") + endif() + endif() endif() set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}") diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake index 6944c6c45..7f8a11460 100644 --- a/cmake/FindLibUSB.cmake +++ b/cmake/FindLibUSB.cmake @@ -99,7 +99,7 @@ if ( LibUSB_FOUND ) check_library_exists ( "${LibUSB_LIBRARIES}" libusb_get_device_list "" LibUSB_VERSION_1.0 ) check_library_exists ( "${LibUSB_LIBRARIES}" libusb_get_port_numbers "" LibUSB_VERSION_1.0.16 ) - if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux")) + if((STATIC AND UNIX AND NOT APPLE) OR (DEPENDS AND CMAKE_SYSTEM_NAME STREQUAL "Linux") OR ANDROID) find_library(LIBUDEV_LIBRARY udev) if(LIBUDEV_LIBRARY) set(LibUSB_LIBRARIES "${LibUSB_LIBRARIES};${LIBUDEV_LIBRARY}") |