################################################################################
#  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
#  Read the zproject/README.md for information about making permanent changes. #
################################################################################
#   CMake toolchain script
#
#   Targets Android 8, ARM
#   Called from build.sh via cmake

set (CMAKE_SYSTEM_NAME Linux)  # Tell CMake we're cross-compiling
set (ANDROID True)
set (BUILD_ANDROID True)

include (CMakeForceCompiler)
include (FindPkgConfig)

# Where is the target environment
set (ANDROID_NDK_ROOT $ENV{ANDROID_NDK_ROOT})
set (ANDROID_SYS_ROOT $ENV{ANDROID_SYS_ROOT})
set (ANDROID_API_LEVEL $ENV{ANDROID_API_LEVEL})
set (TOOLCHAIN_PATH $ENV{TOOLCHAIN_PATH})
set (TOOLCHAIN_HOST $ENV{TOOLCHAIN_HOST})
set (TOOLCHAIN_ARCH $ENV{TOOLCHAIN_ARCH})
set (LIBRARIES_BUILD_PREFIX $ENV{ANDROID_BUILD_PREFIX})

# Here is the target environment located
set (CMAKE_INSTALL_PREFIX "${LIBRARIES_BUILD_PREFIX}")
set (CMAKE_FIND_ROOT_PATH
    "${TOOLCHAIN_PATH}"
    "${LIBRARIES_BUILD_PREFIX}"
    "${LIBRARIES_BUILD_PREFIX}/share")

# pkg_config should not search for packages of the host system,
# but for the target system. To do this, there is the environment variable
# PKG_CONFIG_LIBDIR, which was added to pkg_config explicitely for crosscompiling.
# So set this here to point inside the CMAKE_FIND_ROOT_PATH so it can find
# only packages for the target system when crosscompiling.
set(pkgconfigLibDir)
foreach(currentFindRoot ${CMAKE_FIND_ROOT_PATH})
    set(pkgconfigLibDir "${pkgconfigLibDir}:${currentFindRoot}/lib/pkgconfig")
endforeach(currentFindRoot)
set(ENV{PKG_CONFIG_LIBDIR} "${pkgconfigLibDir}")
set(ENV{PKG_CONFIG_PATH} "")

# Prefix detection only works with compiler id "GNU"
# CMake will look for prefixed g++, cpp, ld, etc. automatically
CMAKE_FORCE_C_COMPILER (${TOOLCHAIN_PATH}/arm-linux-androideabi-gcc GNU)

cmake_policy (SET CMP0015 NEW)   #  Use relative paths in link_directories

include_directories (${ANDROID_SYS_ROOT}/usr/include)
link_directories (${ANDROID_SYS_ROOT}/usr/lib)
