1################################################################################
2#  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
3#  Read the zproject/README.md for information about making permanent changes. #
4################################################################################
5#   CMake toolchain script
6#
7#   Targets Android 8, ARM
8#   Called from build.sh via cmake
9
10set (CMAKE_SYSTEM_NAME Linux)  # Tell CMake we're cross-compiling
11set (ANDROID True)
12set (BUILD_ANDROID True)
13
14include (CMakeForceCompiler)
15include (FindPkgConfig)
16
17# Where is the target environment
18set (ANDROID_NDK_ROOT $ENV{ANDROID_NDK_ROOT})
19set (ANDROID_SYS_ROOT $ENV{ANDROID_SYS_ROOT})
20set (ANDROID_API_LEVEL $ENV{ANDROID_API_LEVEL})
21set (TOOLCHAIN_PATH $ENV{TOOLCHAIN_PATH})
22set (TOOLCHAIN_HOST $ENV{TOOLCHAIN_HOST})
23set (TOOLCHAIN_ARCH $ENV{TOOLCHAIN_ARCH})
24set (LIBRARIES_BUILD_PREFIX $ENV{ANDROID_BUILD_PREFIX})
25
26# Here is the target environment located
27set (CMAKE_INSTALL_PREFIX "${LIBRARIES_BUILD_PREFIX}")
28set (CMAKE_FIND_ROOT_PATH
29    "${TOOLCHAIN_PATH}"
30    "${LIBRARIES_BUILD_PREFIX}"
31    "${LIBRARIES_BUILD_PREFIX}/share")
32
33# pkg_config should not search for packages of the host system,
34# but for the target system. To do this, there is the environment variable
35# PKG_CONFIG_LIBDIR, which was added to pkg_config explicitely for crosscompiling.
36# So set this here to point inside the CMAKE_FIND_ROOT_PATH so it can find
37# only packages for the target system when crosscompiling.
38set(pkgconfigLibDir)
39foreach(currentFindRoot ${CMAKE_FIND_ROOT_PATH})
40    set(pkgconfigLibDir "${pkgconfigLibDir}:${currentFindRoot}/lib/pkgconfig")
41endforeach(currentFindRoot)
42set(ENV{PKG_CONFIG_LIBDIR} "${pkgconfigLibDir}")
43set(ENV{PKG_CONFIG_PATH} "")
44
45# Prefix detection only works with compiler id "GNU"
46# CMake will look for prefixed g++, cpp, ld, etc. automatically
47CMAKE_FORCE_C_COMPILER (${TOOLCHAIN_PATH}/arm-linux-androideabi-gcc GNU)
48
49cmake_policy (SET CMP0015 NEW)   #  Use relative paths in link_directories
50
51include_directories (${ANDROID_SYS_ROOT}/usr/include)
52link_directories (${ANDROID_SYS_ROOT}/usr/lib)
53