summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dankov <tryagain@navit-project.org>2015-11-21 18:43:25 +0300
committerMichael Dankov <tryagain@navit-project.org>2015-11-21 18:48:33 +0300
commit1c9b835f0643ccd90fac10a216932a57ba14163b (patch)
tree93e611ffdea289760ebd82ee0883a1452c68e41c
parent822faf29a6eba3606547331aa6fe3a1e0b000c16 (diff)
downloadnavit-1c9b835f0643ccd90fac10a216932a57ba14163b.tar.gz
Use proper Android NDK level for try_compile
-rwxr-xr-xToolchain/arm-eabi.cmake26
1 files changed, 24 insertions, 2 deletions
diff --git a/Toolchain/arm-eabi.cmake b/Toolchain/arm-eabi.cmake
index ed2e9e237..a50350086 100755
--- a/Toolchain/arm-eabi.cmake
+++ b/Toolchain/arm-eabi.cmake
@@ -1,8 +1,30 @@
set(CMAKE_SYSTEM_NAME GNU)
set(ANDROID TRUE)
-set(ANDROID_API_VERSION 21 CACHE STRING "Andriod API Version")
-set(ANDROID_NDK_API_VERSION ${ANDROID_API_VERSION} CACHE STRING "Andriod NDK API Version")
+
+# Handle environment backed variable:
+# Set variable varname, if it's unset, to the value of environment variable
+# with the same name. If that environment variable does not exist, use default
+# value.
+# Store this variable in the cache and in the environment to make it
+# available for child cmake processes, for example, spawned with
+# try_compile ones.
+macro(env_backed_var varname default description)
+ set(env $ENV{${varname}})
+ if(${varname})
+ set(${var} ${${varname}} CACHE INTERNAL ${description})
+ set(ENV{${varname}} ${${varname}})
+ elseif( env )
+ set(${varname} ${env} CACHE INTERNAL ${description})
+ else()
+ set(${varname} ${default} CACHE INTERNAL ${description})
+ set(ENV{${varname}} ${default})
+ endif()
+endmacro()
+
+env_backed_var(ANDROID_API_VERSION 8 "Android API level")
+env_backed_var(ANDROID_NDK_API_VERSION ${ANDROID_API_VERSION} "Android NDK version")
+
set(ANDROID_ARCH "armeabi" CACHE STRING "Android architecture")
find_program(CMAKE_C_COMPILER NAMES arm-eabi-gcc arm-eabi-gcc.exe arm-linux-androideabi-gcc arm-linux-androideabi-gcc.exe)