From 5c2f9e3eeb89c50fa110daa1f33945381b1416ed Mon Sep 17 00:00:00 2001 From: Haibo Huang Date: Thu, 8 Oct 2020 16:54:36 -0700 Subject: Android: Fatal if ABI is not supported by NDK --- Modules/Platform/Android-Determine.cmake | 6 ++++++ Tests/RunCMake/Android/RunCMakeTest.cmake | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake index 314d80b..58905df 100644 --- a/Modules/Platform/Android-Determine.cmake +++ b/Modules/Platform/Android-Determine.cmake @@ -353,6 +353,12 @@ if(NOT CMAKE_ANDROID_ARCH_ABI) endif() endif() endif() +if(_INCLUDED_ABIS AND NOT CMAKE_ANDROID_ARCH_ABI IN_LIST NDK_DEFAULT_ABIS) + message(FATAL_ERROR + "Android: ABI '${CMAKE_ANDROID_ARCH_ABI}' is not supported by the NDK.\n" + "Supported ABIS: ${NDK_DEFAULT_ABIS}." + ) +endif() set(CMAKE_ANDROID_ARCH "${_ANDROID_ABI_${CMAKE_ANDROID_ARCH_ABI}_ARCH}") if(_ANDROID_SYSROOT_ARCH AND NOT "x${_ANDROID_SYSROOT_ARCH}" STREQUAL "x${CMAKE_ANDROID_ARCH}") message(FATAL_ERROR diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 81dd090..c4b1a00 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -157,7 +157,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) # Find a sysroot to test. file(GLOB _sysroots "${ndk}/platforms/android-[0-9][0-9]/arch-arm") - if(_sysroots) + if(_sysroots AND "armeabi" IN_LIST _abis_) list(GET _sysroots 0 _sysroot) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android -- cgit v0.12