Android: Building SDL 2.0.10 with CMake/Gradle

Are there any instructions how to build SDL2 on Android with CMake? I get a bunch of errors related to hidapi, when I am using the same method to build 2.0.10 as I did with 2.0.8:

[138/138] Linking C shared library X:\GitHub\GunBox-Android__build-output\GunBox-Android__LibraryBuildArtifacts\libsdl2\Debug\arm64-v8a\libSDL2.so
FAILED: X:/GitHub/GunBox-Android/__build-output/GunBox-Android/__LibraryBuildArtifacts/libsdl2/Debug/arm64-v8a/libSDL2.so
cmd.exe /C “cd . && C:\SDKs\Android\SDK\ndk\20.0.5594570\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=aarch64-none-linux-android26 --gcc-toolchain=C:/SDKs/Android/SDK/ndk/20.0.5594570/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/SDKs/Android/SDK/ndk/20.0.5594570/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,–noexecstack -Wformat -Werror=format-security -idirafter X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/video/khronos -IX:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/hidapi/hidapi -Wshadow -fvisibility=hidden -Wdeclaration-after-statement -Werror=declaration-after-statement -fno-strict-aliasing -Wall -O0 -fno-limit-debug-info -Wl,–exclude-libs,libgcc.a -Wl,–exclude-libs,libatomic.a -static-libstdc++ -Wl,–build-id -Wl,–warn-shared-textrel -Wl,–fatal-warnings -Wl,–no-undefined -Qunused-arguments -Wl,-z,noexecstack -shared -Wl,-soname,libSDL2.so -o X:\GitHub\GunBox-Android__build-output\GunBox-Android__LibraryBuildArtifacts\libsdl2\Debug\arm64-v8a\libSDL2.so @CMakeFiles\SDL2.rsp && cd .”
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_ps4.c.o: In function HIDAPI_DriverPS4_Rumble': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_ps4.c:389: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_ps4.c.o: In function HIDAPI_DriverPS4_Update': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_ps4.c:518: undefined reference tohid_read_timeout’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_ps4.c.o: In function ReadFeatureReport': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_ps4.c:241: undefined reference tohid_get_feature_report’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_switch.c.o: In function WriteOutput': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_switch.c:235: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_switch.c.o: In function ReadInput': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_switch.c:230: undefined reference tohid_read_timeout’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xbox360.c.o: In function HIDAPI_DriverXbox360_Rumble': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xbox360.c:372: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xbox360.c.o: In function HIDAPI_DriverXbox360_Update': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xbox360.c:718: undefined reference tohid_read_timeout’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xbox360.c.o: In function SetSlotLED': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xbox360.c:277: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xboxone.c.o: In function HIDAPI_DriverXboxOne_Init': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xboxone.c:165: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xboxone.c.o: In function HIDAPI_DriverXboxOne_Rumble': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xboxone.c:197: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xboxone.c.o: In function HIDAPI_DriverXboxOne_Update': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xboxone.c:276: undefined reference tohid_read_timeout’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapi_xboxone.c.o: In function HIDAPI_DriverXboxOne_HandleModePacket': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapi_xboxone.c:263: undefined reference tohid_write’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapijoystick.c.o: In function HIDAPI_UpdateDeviceList': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:872: undefined reference tohid_enumerate’
X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:882: undefined reference to hid_free_enumeration' SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapijoystick.c.o: In functionHIDAPI_JoystickInit’:
X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:690: undefined reference to hid_init' SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapijoystick.c.o: In functionHIDAPI_JoystickOpen’:
X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:967: undefined reference to hid_open_path' X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:975: undefined reference tohid_close’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapijoystick.c.o: In function HIDAPI_JoystickClose': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:1026: undefined reference tohid_close’
SDL2-2.0.10/CMakeFiles/SDL2.dir/src/joystick/hidapi/SDL_hidapijoystick.c.o: In function HIDAPI_JoystickQuit': X:/GitHub/GunBox-Android/ExternalLibraries/SDL2/SDL2-2.0.10/src/joystick/hidapi/SDL_hidapijoystick.c:1050: undefined reference tohid_exit’
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

I tried turning off HIDAPI and then I got this:

CMake Error at SDL2-2.0.10/CMakeLists.txt:1840 (target_link_libraries):
Cannot specify link libraries for target “hidapi” which is not built by
this project.

https://bugzilla.libsdl.org/show_bug.cgi?id=3918