summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Android/Determine-Compiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-06-02 19:07:02 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-12 14:40:53 (GMT)
commit4389664a26be4d1f96a55c34e5fac9ac1248e5f0 (patch)
tree560b8800749d27ce131b6372b12deba86bfdd232 /Modules/Platform/Android/Determine-Compiler.cmake
parent328191f65f7fb58ece6f749fbfc3462539c7afc1 (diff)
downloadCMake-4389664a26be4d1f96a55c34e5fac9ac1248e5f0.zip
CMake-4389664a26be4d1f96a55c34e5fac9ac1248e5f0.tar.gz
CMake-4389664a26be4d1f96a55c34e5fac9ac1248e5f0.tar.bz2
Android: Detect and save a toolchain from the NDK
Diffstat (limited to 'Modules/Platform/Android/Determine-Compiler.cmake')
-rw-r--r--Modules/Platform/Android/Determine-Compiler.cmake40
1 files changed, 40 insertions, 0 deletions
diff --git a/Modules/Platform/Android/Determine-Compiler.cmake b/Modules/Platform/Android/Determine-Compiler.cmake
index 67cb671..9649b35 100644
--- a/Modules/Platform/Android/Determine-Compiler.cmake
+++ b/Modules/Platform/Android/Determine-Compiler.cmake
@@ -26,5 +26,45 @@ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return()
endif()
+# Identify the host platform.
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ set(_ANDROID_HOST_EXT "")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ set(_ANDROID_HOST_EXT "")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(_ANDROID_HOST_EXT ".exe")
+else()
+ message(FATAL_ERROR "Android: Builds hosted on '${CMAKE_HOST_SYSTEM_NAME}' not supported.")
+endif()
+
+if(CMAKE_ANDROID_NDK)
+ include(Platform/Android/Determine-Compiler-NDK)
+else()
+ set(_ANDROID_TOOL_C_COMPILER "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "")
+ set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "")
+ set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "")
+ set(_ANDROID_TOOL_CXX_COMPILER "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "")
+ set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "")
+ set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "")
+endif()
+
+unset(_ANDROID_HOST_EXT)
+
macro(__android_determine_compiler lang)
+ if(_ANDROID_TOOL_${lang}_COMPILER)
+ set(CMAKE_${lang}_COMPILER "${_ANDROID_TOOL_${lang}_COMPILER}")
+ set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN "${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}")
+
+ # Save the Android-specific information in CMake${lang}Compiler.cmake.
+ set(CMAKE_${lang}_COMPILER_CUSTOM_CODE "
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_VERSION}\")
+set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN \"${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}\")
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_PREFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_PREFIX}\")
+set(CMAKE_${lang}_ANDROID_TOOLCHAIN_SUFFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_SUFFIX}\")
+")
+ endif()
endmacro()