Android: Add test cases covering use of the NDK and standalone toolchains

This commit is contained in:
Brad King 2016-06-21 16:18:56 -04:00
parent 6b84df8da9
commit c2f561e58c
52 changed files with 568 additions and 0 deletions

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,20 @@
^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\):
The value of CMAKE_SYSROOT:
.*
does not match any of the forms:
<ndk>/platforms/android-<api>/arch-<arch>
<standalone-toolchain>/sysroot
where:
<ndk> = Android NDK directory \(with forward slashes\)
<api> = Android API version number \(decimal digits\)
<arch> = Android ARCH name \(lower case\)
<standalone-toolchain> = Path to standalone toolchain prefix
Call Stack \(most recent call first\):
.*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\)
CMakeLists.txt:2 \(project\)$

View File

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.6)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -0,0 +1,218 @@
cmake_minimum_required(VERSION 3.6)
include(RunCMake)
foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN)
string(REPLACE "|" ";" ${v} "${${v}}")
endforeach()
function(run_Android case)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
${RunCMake_TEST_OPTIONS}
${ARGN}
)
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake(${case})
run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .)
endfunction()
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_SYSROOT=${CMAKE_CURRENT_SOURCE_DIR}
)
run_cmake(BadSYSROOT)
unset(RunCMake_TEST_OPTIONS)
foreach(ndk IN LISTS TEST_ANDROID_NDK)
# Load available toolchain versions and abis.
file(GLOB _config_mks
"${ndk}/build/core/toolchains/*/config.mk"
"${ndk}/toolchains/*/config.mk"
)
set(_versions "")
set(_latest_gcc 0)
set(_latest_clang "")
set(_latest_clang_vers 0)
foreach(config_mk IN LISTS _config_mks)
file(STRINGS "${config_mk}" _abis REGEX "^TOOLCHAIN_ABIS +:= +[^ ].*( |$)")
if(_abis AND "${config_mk}" MATCHES [[-((clang)?([0-9]\.[0-9]|))/config\.mk$]])
set(_version "${CMAKE_MATCH_1}")
set(_is_clang "${CMAKE_MATCH_2}")
set(_cur_vers "${CMAKE_MATCH_3}")
if(_is_clang)
if(_latest_clang_vers STREQUAL "")
# already the latest possible
elseif(_cur_vers STREQUAL "" OR _cur_vers VERSION_GREATER _latest_clang_vers)
set(_latest_clang_vers "${_cur_vers}")
set(_latest_clang "${_version}")
endif()
else()
if(_version VERSION_GREATER _latest_gcc)
set(_latest_gcc ${_version})
endif()
endif()
list(APPEND _versions "${_version}")
string(REGEX MATCHALL "[a-z][a-z0-9_-]+" _abis "${_abis}")
list(APPEND _abis_${_version} ${_abis})
endif()
endforeach()
set(_abis_ ${_abis_${_latest_gcc}})
set(_abis_clang ${_abis_${_latest_clang}})
if(_versions MATCHES "clang")
set(_versions "clang" ${_versions})
endif()
list(REMOVE_DUPLICATES _versions)
list(SORT _versions)
set(_versions ";${_versions}")
foreach(vers IN LISTS _versions)
list(REMOVE_DUPLICATES _abis_${vers})
endforeach()
# Test failure cases.
message(STATUS "ndk='${ndk}'")
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_ARCH_ABI=badabi
)
run_cmake(ndk-badabi)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_ARCH_ABI=x86
-DCMAKE_ANDROID_ARM_MODE=0
)
run_cmake(ndk-badarm)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_ARM_NEON=0
)
run_cmake(ndk-badneon)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=badver
)
run_cmake(ndk-badver)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=1.0
)
run_cmake(ndk-badvernum)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_STL_TYPE=badstl
)
run_cmake(ndk-badstl)
unset(RunCMake_TEST_OPTIONS)
# Find a sysroot to test.
file(GLOB _sysroots "${ndk}/platforms/android-[0-9][0-9]/arch-arm")
if(_sysroots)
list(GET _sysroots 0 _sysroot)
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_SYSROOT=${_sysroot}
)
run_cmake(ndk-sysroot-armeabi)
unset(RunCMake_TEST_OPTIONS)
endif()
# Find available STLs.
set(stl_types
none
system
gnustl_static
gnustl_shared
)
if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs")
list(APPEND stl_types gabi++_static gabi++_shared)
endif()
if(IS_DIRECTORY "${ndk}/sources/cxx-stl/stlport/libs")
list(APPEND stl_types stlport_static stlport_shared)
endif()
if(IS_DIRECTORY "${ndk}/sources/cxx-stl/llvm-libc++/libs")
list(APPEND stl_types c++_static c++_shared)
endif()
# List possible ABIs.
set(abi_names
armeabi
armeabi-v6
armeabi-v7a
arm64-v8a
mips
mips64
x86
x86_64
)
# Test all combinations.
foreach(vers IN LISTS _versions)
foreach(stl IN LISTS stl_types)
foreach(config Release Debug)
# Test this combination for all available abis.
message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}' config='${config}'")
set(RunCMake_TEST_OPTIONS
-DCMAKE_ANDROID_NDK=${ndk}
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=${vers}
-DCMAKE_ANDROID_STL_TYPE=${stl}
-DCMAKE_BUILD_TYPE=${config}
)
foreach(abi IN LISTS abi_names)
# Skip ABIs not supported by this compiler.
if(NOT ";${_abis_${vers}};" MATCHES ";${abi};")
continue()
endif()
# Skip combinations that seem to be broken.
if("${stl};${abi}" MATCHES [[^c\+\+_static;armeabi]])
continue()
endif()
# Run the tests for this combination.
if("${abi}" STREQUAL "armeabi")
run_Android(ndk-armeabi-thumb) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi -DCMAKE_ANDROID_ARM_MODE=0
run_Android(ndk-armeabi-arm -DCMAKE_ANDROID_ARM_MODE=1) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi
else()
run_Android(ndk-${abi} -DCMAKE_ANDROID_ARCH_ABI=${abi})
if("${abi}" STREQUAL "armeabi-v7a")
run_Android(ndk-${abi}-neon -DCMAKE_ANDROID_ARCH_ABI=${abi} -DCMAKE_ANDROID_ARM_NEON=1)
endif()
endif()
endforeach()
unset(RunCMake_TEST_OPTIONS)
endforeach()
endforeach()
endforeach()
endforeach()
foreach(toolchain IN LISTS TEST_ANDROID_STANDALONE_TOOLCHAIN)
message(STATUS "toolchain='${toolchain}'")
set(RunCMake_TEST_OPTIONS
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_SYSROOT=${toolchain}/sysroot
)
run_cmake(standalone-sysroot)
unset(RunCMake_TEST_OPTIONS)
foreach(config Release Debug)
message(STATUS "toolchain='${toolchain}' config='${config}'")
set(RunCMake_TEST_OPTIONS
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${toolchain}
-DCMAKE_BUILD_TYPE=${config}
)
run_Android(standalone)
unset(RunCMake_TEST_OPTIONS)
endforeach()
endforeach()

View File

@ -0,0 +1,6 @@
#include "android.h"
int main(void)
{
return 0;
}

View File

@ -0,0 +1,45 @@
#include "android.h"
#ifndef STL_NONE
#include <cmath>
#include <cstdio>
#ifndef STL_SYSTEM
#include <exception>
#include <typeinfo>
#ifndef STL_GABI
#include <iostream>
#include <string>
#endif
#endif
#endif
int main()
{
#if !defined(STL_NONE)
// Require -lm implied by linking as C++.
std::printf("%p\n", static_cast<double (*)(double)>(&std::sin));
#endif
#if defined(STL_NONE)
return 0;
#elif defined(STL_SYSTEM)
return 0;
#else
try {
delete (new int);
} catch (std::exception const& e) {
#if defined(STL_GABI)
e.what();
typeid(e).name();
#else
std::cerr << e.what() << std::endl;
std::cerr << typeid(e).name() << std::endl;
#endif
}
#if defined(STL_GABI)
return 0;
#else
std::string s;
return static_cast<int>(s.size());
#endif
#endif
}

View File

@ -0,0 +1,103 @@
#ifndef __ANDROID__
#error "__ANDROID__ not defined"
#endif
#include <android/api-level.h>
#if API_LEVEL != __ANDROID_API__
#error "API levels do not match"
#endif
#ifdef COMPILER_IS_CLANG
#ifndef __clang__
#error "COMPILER_IS_CLANG but __clang__ is not defined"
#endif
#else
#ifdef __clang__
#error "!COMPILER_IS_CLANG but __clang__ is defined"
#endif
#endif
#ifdef ARM_MODE
#if ARM_MODE == 1 && defined(__thumb__)
#error "ARM_MODE==1 but __thumb__ is defined"
#elif ARM_MODE == 0 && !defined(__thumb__)
#error "ARM_MODE==0 but __thumb__ is not defined"
#endif
#endif
#ifdef ARM_NEON
#if ARM_NEON == 0 && defined(__ARM_NEON__)
#error "ARM_NEON==0 but __ARM_NEON__ is defined"
#elif ARM_NEON == 1 && !defined(__ARM_NEON__)
#error "ARM_NEON==1 but __ARM_NEON__ is not defined"
#endif
#endif
#ifdef ABI_armeabi
#ifndef __ARM_EABI__
#error "ABI_armeabi: __ARM_EABI__ not defined"
#endif
#if __ARM_ARCH != 5
#error "ABI_armeabi: __ARM_ARCH is not 5"
#endif
#endif
#ifdef ABI_armeabi_v6
#ifndef __ARM_EABI__
#error "ABI_armeabi_v6: __ARM_EABI__ not defined"
#endif
#if __ARM_ARCH != 6
#error "ABI_armeabi_v6: __ARM_ARCH is not 6"
#endif
#endif
#ifdef ABI_armeabi_v7a
#ifndef __ARM_EABI__
#error "ABI_armeabi_v7a: __ARM_EABI__ not defined"
#endif
#if __ARM_ARCH != 7
#error "ABI_armeabi_v7a: __ARM_ARCH is not 7"
#endif
#endif
#ifdef ABI_arm64_v8a
#ifdef __ARM_EABI__
#error "ABI_arm64_v8a: __ARM_EABI__ defined"
#endif
#ifndef __aarch64__
#error "ABI_arm64_v8a: __aarch64__ not defined"
#endif
#endif
#ifdef ABI_mips
#if __mips != 32
#error "ABI_mips: __mips != 32"
#endif
#ifndef _ABIO32
#error "ABI_mips: _ABIO32 not defined"
#endif
#endif
#ifdef ABI_mips64
#if __mips != 64
#error "ABI_mips64: __mips != 64"
#endif
#ifndef _ABI64
#error "ABI_mips: _ABI64 not defined"
#endif
#endif
#ifdef ABI_x86
#ifndef __i686__
#error "ABI_x86: __i686__ not defined"
#endif
#endif
#ifdef ABI_x86_64
#ifndef __x86_64__
#error "ABI_x86_64: __x86_64__ not defined"
#endif
#endif
#include <stddef.h>

View File

@ -0,0 +1,56 @@
enable_language(C)
enable_language(CXX)
foreach(f
"${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
)
if(NOT EXISTS "${f}")
message(SEND_ERROR "Expected file does not exist:\n \"${f}\"")
endif()
endforeach()
string(APPEND CMAKE_C_FLAGS " -Werror")
string(APPEND CMAKE_CXX_FLAGS " -Werror")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-no-undefined")
if(CMAKE_ANDROID_NDK)
if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang")
add_definitions(-DCOMPILER_IS_CLANG)
endif()
elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
execute_process(
COMMAND ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang --version
OUTPUT_VARIABLE _out
ERROR_VARIABLE _err
RESULT_VARIABLE _res
)
if(_res EQUAL 0)
add_definitions(-DCOMPILER_IS_CLANG)
endif()
endif()
if(CMAKE_ANDROID_STL_TYPE STREQUAL "none")
add_definitions(-DSTL_NONE)
elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "system")
add_definitions(-DSTL_SYSTEM)
elseif(CMAKE_ANDROID_STL_TYPE MATCHES [[^gabi\+\+]])
add_definitions(-DSTL_GABI)
endif()
string(REPLACE "-" "_" abi "${CMAKE_ANDROID_ARCH_ABI}")
add_definitions(-DABI_${abi})
add_definitions(-DAPI_LEVEL=${CMAKE_SYSTEM_VERSION})
if(CMAKE_ANDROID_ARCH_ABI MATCHES "^armeabi")
add_definitions(-DARM_MODE=${CMAKE_ANDROID_ARM_MODE})
message(STATUS "CMAKE_ANDROID_ARM_MODE=${CMAKE_ANDROID_ARM_MODE}")
endif()
if(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
add_definitions(-DARM_NEON=${CMAKE_ANDROID_ARM_NEON})
message(STATUS "CMAKE_ANDROID_ARM_NEON=${CMAKE_ANDROID_ARM_NEON}")
endif()
add_executable(android_c android.c)
add_executable(android_cxx android.cxx)

View File

@ -0,0 +1,2 @@
-- Android: Targeting API '[0-9]+' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1,3 @@
-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi', and processor 'armv5te'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'
.*-- CMAKE_ANDROID_ARM_MODE=1

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1,3 @@
-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi', and processor 'armv5te'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'
.*-- CMAKE_ANDROID_ARM_MODE=0

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1,3 @@
-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'
.*-- CMAKE_ANDROID_ARM_NEON=1

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1,3 @@
-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'
.*-- CMAKE_ANDROID_ARM_NEON=0

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,5 @@
^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\):
Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='badabi'.
Call Stack \(most recent call first\):
.*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\)
CMakeLists.txt:[0-9]+ \(project\)$

View File

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,6 @@
^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\):
Android: CMAKE_ANDROID_ARM_MODE is set but is valid only for 'armeabi'
architectures.
Call Stack \(most recent call first\):
.*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\)
CMakeLists.txt:[0-9]+ \(project\)$

View File

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,6 @@
^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\):
Android: CMAKE_ANDROID_ARM_NEON is set but is valid only for 'armeabi-v7a'
architecture.
Call Stack \(most recent call first\):
.*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\)
CMakeLists.txt:[0-9]+ \(project\)$

View File

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,9 @@
^CMake Error at .*/Modules/Platform/Android-Common.cmake:[0-9]+ \(message\):
The CMAKE_ANDROID_STL_TYPE 'badstl' is not one of the allowed values:
.*
Call Stack \(most recent call first\):
.*
ndk-badstl.cmake:1 \(enable_language\)
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
enable_language(CXX)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,12 @@
^CMake Error at .*/Modules/Platform/Android/Determine-Compiler-NDK.cmake:[0-9]+ \(message\):
Android: The CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION value 'badver' is not one
of the allowed forms:
<major>.<minor> = GCC of specified version
clang<major>.<minor> = Clang of specified version
clang = Clang of most recent available version
Call Stack \(most recent call first\):
.*
ndk-badver.cmake:1 \(enable_language\)
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
enable_language(C)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,13 @@
^CMake Error at .*/Modules/Platform/Android/Determine-Compiler-NDK.cmake:[0-9]+ \(message\):
Android: No toolchain for ABI 'armeabi' found in the NDK:
.*
of the version specified by CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION:
1\.0
Call Stack \(most recent call first\):
.*
ndk-badvernum.cmake:1 \(enable_language\)
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
enable_language(C)

View File

@ -0,0 +1,2 @@
-- Android: Targeting API '[0-9]+' with architecture 'mips', ABI 'mips', and processor 'mips'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1,2 @@
-- Android: Targeting API '[0-9]+' with architecture 'mips64', ABI 'mips64', and processor 'mips64'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1 @@
-- Android: Targeting API '[0-9][0-9]' with architecture 'arm', ABI 'armeabi', and processor 'armv5te'

View File

@ -0,0 +1,2 @@
-- Android: Targeting API '[0-9]+' with architecture 'x86', ABI 'x86', and processor 'i686'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1,2 @@
-- Android: Targeting API '[0-9]+' with architecture 'x86_64', ABI 'x86_64', and processor 'x86_64'
-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+'

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -0,0 +1 @@
-- Android: Targeting API '[0-9]+' with architecture '[a-z0-9_-]+', ABI '[a-z0-9_-]+', and processor '[a-z0-9_-]+'

View File

@ -0,0 +1 @@
-- Android: Targeting API '[0-9]+' with architecture '[a-z0-9_-]+', ABI '[a-z0-9_-]+', and processor '[a-z0-9_-]+'

View File

@ -0,0 +1 @@
include(common.cmake)

View File

@ -327,3 +327,24 @@ add_RunCMake_test_group(CPack "DEB;RPM;TGZ")
# add a test to make sure symbols are exported from a shared library # add a test to make sure symbols are exported from a shared library
# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
add_RunCMake_test(AutoExportDll) add_RunCMake_test(AutoExportDll)
if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN)
if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators")
endif()
foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN)
if(CMake_${v})
string(REPLACE ";" "|" ${v} "${CMake_${v}}")
list(APPEND Android_ARGS "-D${v}=${${v}}")
endif()
endforeach()
add_RunCMake_test(Android)
# This test can take a very long time due to lots of combinations.
# Use a long default timeout and provide an option to customize it.
if(NOT DEFINED CMake_TEST_ANDROID_TIMEOUT)
set(CMake_TEST_ANDROID_TIMEOUT 3000)
endif()
set_property(TEST RunCMake.Android PROPERTY TIMEOUT ${CMake_TEST_ANDROID_TIMEOUT})
endif()