1 # Toolchain config for Android NDK.
2 # This is expected to be used with a standalone Android toolchain (see
3 # docs/STANDALONE-TOOLCHAIN.html in the NDK on how to get one).
6 # mkdir build; cd build
8 # mkdir android; cd android
9 # cmake -DLLVM_ANDROID_TOOLCHAIN_DIR=/path/to/android/ndk \
10 # -DCMAKE_TOOLCHAIN_FILE=../../cmake/platforms/Android.cmake ../..
13 SET(CMAKE_SYSTEM_NAME Linux)
15 IF(NOT CMAKE_C_COMPILER)
16 SET(CMAKE_C_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang)
19 IF(NOT CMAKE_CXX_COMPILER)
20 SET(CMAKE_CXX_COMPILER ${CMAKE_BINARY_DIR}/../bin/clang++)
23 SET(ANDROID "1" CACHE STRING "ANDROID" FORCE)
25 SET(ANDROID_COMMON_FLAGS "-target arm-linux-androideabi --sysroot=${LLVM_ANDROID_TOOLCHAIN_DIR}/sysroot -B${LLVM_ANDROID_TOOLCHAIN_DIR}")
26 SET(CMAKE_C_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE)
27 SET(CMAKE_CXX_FLAGS "${ANDROID_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE)
28 SET(CMAKE_EXE_LINKER_FLAGS "-pie" CACHE STRING "toolchain_exelinkflags" FORCE)