mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
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>
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user