Android-Determine.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #=============================================================================
  2. # Copyright 2015-2016 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # When CMAKE_SYSTEM_NAME is "Android", CMakeDetermineSystem loads this module.
  14. # This module detects platform-wide information about the Android target
  15. # in order to store it in "CMakeSystem.cmake".
  16. # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
  17. # implemented in the CMake VS IDE generators. Avoid interfering with
  18. # that functionality for now. Later we may try to integrate this.
  19. if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
  20. return()
  21. endif()
  22. # Find the Android NDK.
  23. if(CMAKE_ANDROID_NDK)
  24. if(NOT IS_DIRECTORY "${CMAKE_ANDROID_NDK}")
  25. message(FATAL_ERROR
  26. "Android: The NDK root directory specified by CMAKE_ANDROID_NDK:\n"
  27. " ${CMAKE_ANDROID_NDK}\n"
  28. "does not exist."
  29. )
  30. endif()
  31. else()
  32. if(IS_DIRECTORY "$ENV{ANDROID_NDK_ROOT}")
  33. file(TO_CMAKE_PATH "$ENV{ANDROID_NDK_ROOT}" CMAKE_ANDROID_NDK)
  34. endif()
  35. # TODO: Search harder for the NDK.
  36. endif()
  37. if(NOT CMAKE_ANDROID_NDK)
  38. message(FATAL_ERROR "Android: The NDK root directory was not found.")
  39. endif()
  40. # Save the Android-specific information in CMakeSystem.cmake.
  41. set(CMAKE_SYSTEM_CUSTOM_CODE "
  42. set(CMAKE_ANDROID_NDK \"${CMAKE_ANDROID_NDK}\")
  43. ")