From b618db8f750d1201dceb05620978236aa44ce265 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Tue, 6 Sep 2022 11:56:30 +0200
Subject: [PATCH 3/4] fix android toolchain broken
 CMAKE_CXX_IMPLICIT_LINK_LIBRARIES

CMake 3.17.0 and Android NDK 25 the CMAKE_CXX_IMPLICIT_LINK_LIBRARIES is
c++;m;-l:libunwind.a;dl;c;-l:libunwind.a;dl

When it should be
c++;m;unwind;dl;c;unwind;dl
---
 gme/CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gme/CMakeLists.txt b/gme/CMakeLists.txt
index da23ea8..cc058c7 100644
--- a/gme/CMakeLists.txt
+++ b/gme/CMakeLists.txt
@@ -196,6 +196,13 @@ set_target_properties(gme
 foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
     if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
         list(APPEND IMPLICITS_LIST "${LIB}")
+    elseif(LIB MATCHES "-l:lib.*.a")
+        string(LENGTH ${LIB} LIBLEN)
+        math(EXPR LIBLEN "${LIBLEN}-8")
+        string(SUBSTRING ${LIB} 6 ${LIBLEN} DIRECT_LIB)
+        list(APPEND IMPLICITS_LIST "-l${DIRECT_LIB}")
+    elseif(LIB MATCHES "-l.*")
+        list(APPEND IMPLICITS_LIST "${LIB}")
     else()
         list(APPEND IMPLICITS_LIST "-l${LIB}")
     endif()
-- 
2.45.0.windows.1

