From 7cd8920eec2d51109b2b094e1d5b18eb3840364e Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Fri, 3 May 2013 21:35:37 -0700 Subject: [PATCH] Fix Android target build on Apple hosts. Currently CMakeLists.txt forces CMAKE_C_COMPILER to clang whenever compiling on an APPLE host. Unfortunately, this prevents the android.toolchain.cmake script from selecting the correct cross compiler. See [line 1136][]. To avoid this problem, only force clang if ANDROID_NDK is not set. This is one of the variables used by Android.mk. [line 1136]: https://github.com/apitrace/apitrace/blob/master/cmake/toolchain/android.toolchain.cmake#L1136 --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33638f5..91643c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required (VERSION 2.8) # Use clang on MacOSX. gcc doesn't support __thread key, and Apple has # abandoned it for clang. This must be done before the project is defined. -if (APPLE) +# But DONT force clang if we are cross-compiling to Android. +if (APPLE AND NOT ANDROID_NDK) set (CMAKE_C_COMPILER "clang") set (CMAKE_CXX_COMPILER "clang++") endif () -- 2.43.0