From c958fdbc1b64b4591e434e5b6ae702e36b87af5c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 8 Mar 2022 16:52:57 +0100 Subject: Android: Set CMAKE_TRY_COMPILE_PLATFORM_VARIABLES These are the variables that cmake will pass onto itself when doing a try_compile, we need that because otherwise when trying to find iconv it will issue a try compile, won't pass CMAKE_ANDROID_API so it will default to 21 (instead eg the 28 we had given it) and the try_compile will fail because android libc only has iconv after API 28 --- toolchain/Android.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 280f129d..e4c739b0 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -196,6 +196,17 @@ set(ANDROID_PLATFORM "android-${CMAKE_ANDROID_API}") set(ANDROID_STL ${CMAKE_ANDROID_STL_TYPE}) include(${CMAKE_ANDROID_NDK}/build/cmake/android.toolchain.cmake REQUIRED) +# Export configurable variables for the try_compile() command. +list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + CMAKE_ANDROID_NDK + CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION + CMAKE_ANDROID_API + CMAKE_ANDROID_ARCH + CMAKE_ANDROID_ARCH_ABI + ANDROID_SDK_ROOT + ANDROID_SDK_COMPILE_API +) + ## HACK: Remove when we can depend on NDK r23 # Workaround issue https://github.com/android/ndk/issues/929 if(ANDROID_NDK_MAJOR VERSION_LESS 23) -- cgit v1.2.1