summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Android-Clang.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-26 16:48:35 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-26 18:17:07 (GMT)
commit97bca2f9fab58fcf5bbcb29e1e7e86e37b5cc1e0 (patch)
tree048fee25cd8797b3527994c504c5b8ce50e2ede2 /Modules/Platform/Android-Clang.cmake
parent19f36c5fb2497703e4f071b3a9424a8d121ccef9 (diff)
downloadCMake-97bca2f9fab58fcf5bbcb29e1e7e86e37b5cc1e0.zip
CMake-97bca2f9fab58fcf5bbcb29e1e7e86e37b5cc1e0.tar.gz
CMake-97bca2f9fab58fcf5bbcb29e1e7e86e37b5cc1e0.tar.bz2
Android: Use unified toolchain in NDK r19+
The NDK build system now uses only a single toolchain in <ndk>/toolchains/llvm/prebuilt/<host> Its compilers are always `bin/{clang,clang++}` and its binutils are always `bin/<triple>-*`. It is a standalone toolchain: * The Anrdoid API level is specified at the end of `--target=`. * The standard library may be specified via `-stdlib=`. * No need to pass system includes or libraries explicitly. * No need to pass `--sysroot` or `-gcc-toolchain`. Teach CMake to recognize NDK versions that have a unified toolchain with its own sysroot and use the above approach. Fixes: #18739
Diffstat (limited to 'Modules/Platform/Android-Clang.cmake')
-rw-r--r--Modules/Platform/Android-Clang.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/Platform/Android-Clang.cmake b/Modules/Platform/Android-Clang.cmake
index 9ed1e01..847178f 100644
--- a/Modules/Platform/Android-Clang.cmake
+++ b/Modules/Platform/Android-Clang.cmake
@@ -40,6 +40,9 @@ macro(__android_compiler_clang lang)
endif()
if(NOT CMAKE_${lang}_COMPILER_TARGET)
set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}")
+ if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
+ string(APPEND CMAKE_${lang}_COMPILER_TARGET "${CMAKE_SYSTEM_VERSION}")
+ endif()
list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "--target=${CMAKE_${lang}_COMPILER_TARGET}")
endif()
endmacro()