summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-06-02 15:16:21 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-12 14:40:52 (GMT)
commit52b6effd817ae44577f86df4f382b0c98df7402a (patch)
tree1eecdf69e7562c05aac841a4370e06639c53f3bf /Modules
parent8e0cb45e5591cc778b054780f9e6290c3f239815 (diff)
downloadCMake-52b6effd817ae44577f86df4f382b0c98df7402a.zip
CMake-52b6effd817ae44577f86df4f382b0c98df7402a.tar.gz
CMake-52b6effd817ae44577f86df4f382b0c98df7402a.tar.bz2
Android: Detect and save the NDK directory
Add a new CMakeSystem.cmake entry for the NDK location.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Platform/Android-Determine.cmake27
1 files changed, 27 insertions, 0 deletions
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index 6a33290..7e7acd4 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -12,6 +12,8 @@
# License text for the above reference.)
# When CMAKE_SYSTEM_NAME is "Android", CMakeDetermineSystem loads this module.
+# This module detects platform-wide information about the Android target
+# in order to store it in "CMakeSystem.cmake".
# Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
# implemented in the CMake VS IDE generators. Avoid interfering with
@@ -19,3 +21,28 @@
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
return()
endif()
+
+# Find the Android NDK.
+if(CMAKE_ANDROID_NDK)
+ if(NOT IS_DIRECTORY "${CMAKE_ANDROID_NDK}")
+ message(FATAL_ERROR
+ "Android: The NDK root directory specified by CMAKE_ANDROID_NDK:\n"
+ " ${CMAKE_ANDROID_NDK}\n"
+ "does not exist."
+ )
+ endif()
+else()
+ if(IS_DIRECTORY "$ENV{ANDROID_NDK_ROOT}")
+ file(TO_CMAKE_PATH "$ENV{ANDROID_NDK_ROOT}" CMAKE_ANDROID_NDK)
+ endif()
+ # TODO: Search harder for the NDK.
+endif()
+
+if(NOT CMAKE_ANDROID_NDK)
+ message(FATAL_ERROR "Android: The NDK root directory was not found.")
+endif()
+
+# Save the Android-specific information in CMakeSystem.cmake.
+set(CMAKE_SYSTEM_CUSTOM_CODE "
+set(CMAKE_ANDROID_NDK \"${CMAKE_ANDROID_NDK}\")
+")