]> git.cworth.org Git - apitrace/commitdiff
Fix Android target build on Apple hosts.
authorBen Kelly <ben@wanderview.com>
Sat, 4 May 2013 04:35:37 +0000 (21:35 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 4 May 2013 07:46:50 +0000 (08:46 +0100)
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

index 33638f5f89e2e22b64a401517b81b7cb5e868ac5..91643c2f107fe98952f930ac6777f41f57cfdeee 100644 (file)
@@ -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 ()