Android.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Include the NDK hook.
  2. # It can be used by NDK to inject necessary fixes for an earlier cmake.
  3. if(CMAKE_ANDROID_NDK)
  4. include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL)
  5. endif()
  6. include(Platform/Linux)
  7. set(ANDROID 1)
  8. # Natively compiling on an Android host doesn't need these flags to be reset.
  9. if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android")
  10. return()
  11. endif()
  12. # Conventionally Android does not use versioned soname
  13. # But in modern versions it is acceptable
  14. if(NOT DEFINED CMAKE_PLATFORM_NO_VERSIONED_SONAME)
  15. set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
  16. endif()
  17. # Android reportedly ignores RPATH, and we cannot predict the install
  18. # location anyway.
  19. set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
  20. # Nsight Tegra Visual Studio Edition takes care of
  21. # prefixing library names with '-l'.
  22. if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
  23. set(CMAKE_LINK_LIBRARY_FLAG "")
  24. endif()
  25. # Commonly used Android toolchain files that pre-date CMake upstream support
  26. # set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
  27. if(CMAKE_SYSTEM_VERSION EQUAL 1)
  28. return()
  29. endif()
  30. # Include the NDK hook.
  31. # It can be used by NDK to inject necessary fixes for an earlier cmake.
  32. if(CMAKE_ANDROID_NDK)
  33. include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android.cmake OPTIONAL)
  34. endif()