Android: Avoid interfering with common pre-existing toolchain files

Commonly used Android toolchain files that pre-date CMake upstream
support may need to be updated to work with our new functionality.
They typically set CMAKE_SYSTEM_VERSION to 1, so detect that and
skip our upstream Android settings.  When such toolchain files are
updated to account for our upstream support, they can then set
CMAKE_SYSTEM_VERSION to a valid Android API and get new behavior.
This commit is contained in:
Brad King 2016-06-06 13:56:21 -04:00
parent 6299693f8a
commit fa63257821
5 changed files with 36 additions and 0 deletions

View File

@ -26,6 +26,14 @@ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return() return()
endif() endif()
# Commonly used Android toolchain files that pre-date CMake upstream support
# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
macro(__android_compiler_clang lang)
endmacro()
return()
endif()
include(Platform/Android-Common) include(Platform/Android-Common)
macro(__android_compiler_clang lang) macro(__android_compiler_clang lang)

View File

@ -22,6 +22,12 @@ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return() return()
endif() endif()
# Commonly used Android toolchain files that pre-date CMake upstream support
# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
# If the user provided CMAKE_SYSROOT for us, extract information from it. # If the user provided CMAKE_SYSROOT for us, extract information from it.
set(_ANDROID_SYSROOT_NDK "") set(_ANDROID_SYSROOT_NDK "")
set(_ANDROID_SYSROOT_API "") set(_ANDROID_SYSROOT_API "")

View File

@ -26,6 +26,14 @@ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return() return()
endif() endif()
# Commonly used Android toolchain files that pre-date CMake upstream support
# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
macro(__android_compiler_gnu lang)
endmacro()
return()
endif()
include(Platform/Android-Common) include(Platform/Android-Common)
macro(__android_compiler_gnu lang) macro(__android_compiler_gnu lang)

View File

@ -21,6 +21,12 @@ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return() return()
endif() endif()
# Commonly used Android toolchain files that pre-date CMake upstream support
# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()
if(NOT CMAKE_SYSROOT) if(NOT CMAKE_SYSROOT)
if(CMAKE_ANDROID_NDK) if(CMAKE_ANDROID_NDK)
set(CMAKE_SYSROOT "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}") set(CMAKE_SYSROOT "${CMAKE_ANDROID_NDK}/platforms/android-${CMAKE_SYSTEM_VERSION}/arch-${CMAKE_ANDROID_ARCH}")

View File

@ -26,6 +26,14 @@ if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return() return()
endif() endif()
# Commonly used Android toolchain files that pre-date CMake upstream support
# set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
if(CMAKE_SYSTEM_VERSION EQUAL 1)
macro(__android_determine_compiler lang)
endmacro()
return()
endif()
# Identify the host platform. # Identify the host platform.
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(_ANDROID_HOST_EXT "") set(_ANDROID_HOST_EXT "")