diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index cdce6f64e3..275b66cecb 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -173,6 +173,7 @@ Variables that Describe the System .. toctree:: :maxdepth: 1 + /variable/ANDROID /variable/APPLE /variable/BORLAND /variable/CMAKE_CL_64 diff --git a/Help/variable/ANDROID.rst b/Help/variable/ANDROID.rst new file mode 100644 index 0000000000..fede4caf3e --- /dev/null +++ b/Help/variable/ANDROID.rst @@ -0,0 +1,5 @@ +ANDROID +------- + +Set to ``1`` when the target system (:variable:`CMAKE_SYSTEM_NAME`) is +``Android``. diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake index 1bdad0403a..3d69733bb2 100644 --- a/Modules/Platform/Android.cmake +++ b/Modules/Platform/Android.cmake @@ -1,5 +1,7 @@ include(Platform/Linux) +set(ANDROID 1) + # Android has soname, but binary names must end in ".so" so we cannot append # a version number. Also we cannot portably represent symlinks on the host. set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1) diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index a679f6c648..7eac5d6137 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -1,6 +1,10 @@ enable_language(C) enable_language(CXX) +if(NOT ANDROID) + message(SEND_ERROR "CMake variable 'ANDROID' is not set to a true value.") +endif() + foreach(f "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"