summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-11 19:50:50 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-14 19:29:14 (GMT)
commit3d42a72bd5827ea875bbba830ecff90b3aaf54d6 (patch)
tree42c81177565ec26840faa20433fefdafbb2813a3 /Tests
parent4a4be0301bd9c6062738e87892cbe5bd8d900a49 (diff)
downloadCMake-3d42a72bd5827ea875bbba830ecff90b3aaf54d6.zip
CMake-3d42a72bd5827ea875bbba830ecff90b3aaf54d6.tar.gz
CMake-3d42a72bd5827ea875bbba830ecff90b3aaf54d6.tar.bz2
Android: Always set CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION
When this variable is not set by the user or toolchain file, set it to the default selected. This will be useful for client code that needs to pass the value to an external tool that needs to find the same toolchain in the NDK. Leave it empty for a standalone toolchain. Suggested-by: Ruslan Baratov <ruslan_baratov@yahoo.com>
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/Android/common.cmake9
1 files changed, 8 insertions, 1 deletions
diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake
index d803c98..18c9797 100644
--- a/Tests/RunCMake/Android/common.cmake
+++ b/Tests/RunCMake/Android/common.cmake
@@ -22,8 +22,15 @@ string(APPEND CMAKE_CXX_FLAGS " -Werror -Wno-attributes")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-no-undefined")
if(CMAKE_ANDROID_NDK)
- if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang")
+ if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
+ message(SEND_ERROR "CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION is not set!")
+ elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "^clang")
add_definitions(-DCOMPILER_IS_CLANG)
+ elseif(NOT "${CMAKE_C_COMPILER}" MATCHES "toolchains/[^/]+-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}/prebuilt")
+ message(SEND_ERROR "CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION is\n"
+ " ${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}\n"
+ "which does not appear in CMAKE_C_COMPILER:\n"
+ " ${CMAKE_C_COMPILER}")
endif()
elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
execute_process(