summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Android/Determine-Compiler-NDK.cmake
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-18 15:02:57 (GMT)
commit236d6244a0f44fbe0f50f16fb259a3817ce463c4 (patch)
treeb9131b504a35579285c5f43e302e19bd9468a043 /Modules/Platform/Android/Determine-Compiler-NDK.cmake
parent5cfc2e926af645840c6a0464451af18f08528879 (diff)
downloadCMake-236d6244a0f44fbe0f50f16fb259a3817ce463c4.zip
CMake-236d6244a0f44fbe0f50f16fb259a3817ce463c4.tar.gz
CMake-236d6244a0f44fbe0f50f16fb259a3817ce463c4.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 'Modules/Platform/Android/Determine-Compiler-NDK.cmake')
-rw-r--r--Modules/Platform/Android/Determine-Compiler-NDK.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
index 953bc85..a33935b 100644
--- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake
+++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
@@ -52,6 +52,7 @@ unset(_ANDROID_CONFIG_MK_PATTERNS)
# Find the newest toolchain version matching the ABI.
set(_ANDROID_TOOL_NAME "")
set(_ANDROID_TOOL_VERS 0)
+set(_ANDROID_TOOL_VERS_NDK "")
set(_ANDROID_TOOL_SETUP_MK "")
foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS)
# Check that the toolchain matches the ABI.
@@ -62,18 +63,21 @@ foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS)
unset(_ANDROID_TOOL_ABIS)
# Check the version.
- if("${config_mk}" MATCHES [[/([^/]+-(clang)?([0-9]\.[0-9]|))/config.mk$]])
+ if("${config_mk}" MATCHES [[/([^/]+-((clang)?([0-9]\.[0-9]|)))/config.mk$]])
set(_ANDROID_CUR_NAME "${CMAKE_MATCH_1}")
- set(_ANDROID_CUR_VERS "${CMAKE_MATCH_3}")
+ set(_ANDROID_CUR_VERS "${CMAKE_MATCH_4}")
+ set(_ANDROID_CUR_VERS_NDK "${CMAKE_MATCH_2}")
if(_ANDROID_TOOL_VERS STREQUAL "")
# already the latest possible
elseif(_ANDROID_CUR_VERS STREQUAL "" OR _ANDROID_CUR_VERS VERSION_GREATER _ANDROID_TOOL_VERS)
set(_ANDROID_TOOL_NAME "${_ANDROID_CUR_NAME}")
set(_ANDROID_TOOL_VERS "${_ANDROID_CUR_VERS}")
+ set(_ANDROID_TOOL_VERS_NDK "${_ANDROID_CUR_VERS_NDK}")
string(REPLACE "/config.mk" "/setup.mk" _ANDROID_TOOL_SETUP_MK "${config_mk}")
endif()
unset(_ANDROID_CUR_TOOL)
unset(_ANDROID_CUR_VERS)
+ unset(_ANDROID_CUR_VERS_NDK)
endif()
endforeach()
@@ -206,6 +210,8 @@ endif()
# Help CMakeFindBinUtils locate things.
set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
+set(_ANDROID_TOOL_NDK_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS_NDK}")
+
set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS}")
set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/${_ANDROID_TOOL_PREFIX}")
set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
@@ -231,6 +237,7 @@ endif()
if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
message(STATUS "_ANDROID_TOOL_NAME=${_ANDROID_TOOL_NAME}")
message(STATUS "_ANDROID_TOOL_VERS=${_ANDROID_TOOL_VERS}")
+ message(STATUS "_ANDROID_TOOL_VERS_NDK=${_ANDROID_TOOL_VERS_NDK}")
message(STATUS "_ANDROID_TOOL_PREFIX=${_ANDROID_TOOL_PREFIX}")
message(STATUS "_ANDROID_TOOL_CLANG_NAME=${_ANDROID_TOOL_CLANG_NAME}")
message(STATUS "_ANDROID_TOOL_CLANG_VERS=${_ANDROID_TOOL_CLANG_VERS}")
@@ -239,6 +246,7 @@ endif()
unset(_ANDROID_TOOL_NAME)
unset(_ANDROID_TOOL_VERS)
+unset(_ANDROID_TOOL_VERS_NDK)
unset(_ANDROID_TOOL_PREFIX)
unset(_ANDROID_TOOL_CLANG_NAME)
unset(_ANDROID_TOOL_CLANG_VERS)