summaryrefslogtreecommitdiff
path: root/Modules/Platform/Android-Determine.cmake
diff options
context:
space:
mode:
authorMichael Karcher <kitware@mkarcher.dialup.fu-berlin.de>2023-04-21 16:58:02 +0200
committerMichael Karcher <kitware@mkarcher.dialup.fu-berlin.de>2023-04-26 18:11:23 +0200
commitca6e81a31fbb170d04872490a28b93d509dd5435 (patch)
treede8ca61c5eca9e8648e13f56841080aa5f866c3c /Modules/Platform/Android-Determine.cmake
parent663cc941bd176347fb2fa89191629c6843bb4ebd (diff)
downloadcmake-ca6e81a31fbb170d04872490a28b93d509dd5435.tar.gz
VS/Android: Deduce processor type from CMAKE_GENERATOR_PLATFORM
Closes: #24839
Diffstat (limited to 'Modules/Platform/Android-Determine.cmake')
-rw-r--r--Modules/Platform/Android-Determine.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index bc60222476..307e4c9a53 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -34,8 +34,21 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# If using Android tools for Visual Studio, compile a sample project to get the
-# NDK path
+# NDK path and set the processor from the generator platform.
if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ if(NOT CMAKE_ANDROID_ARCH_ABI AND NOT CMAKE_SYSTEM_PROCESSOR)
+ if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
+ set(CMAKE_SYSTEM_PROCESSOR "armv7-a")
+ elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
+ set(CMAKE_SYSTEM_PROCESSOR "aarch64")
+ elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x86")
+ set(CMAKE_SYSTEM_PROCESSOR "i686")
+ elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
+ set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+ else()
+ message(FATAL_ERROR "Unhandled generator platform, please choose ARM, ARM64, x86 or x86_64 using -A")
+ endif()
+ endif()
if(NOT CMAKE_ANDROID_NDK)
set(vcx_platform ${CMAKE_GENERATOR_PLATFORM})
if(CMAKE_GENERATOR MATCHES "Visual Studio 14")