Android.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. # NDK organizes API level specific libraries in numbered subdirectories. To
  13. # avoid incorrect inclusion of libraries below the targeted API level, disable
  14. # architecture specific path suffixes by default.
  15. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF)
  16. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
  17. # Conventionally Android does not use versioned soname
  18. # But in modern versions it is acceptable
  19. if(NOT DEFINED CMAKE_PLATFORM_NO_VERSIONED_SONAME)
  20. set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
  21. endif()
  22. # Android reportedly ignores RPATH, and we cannot predict the install
  23. # location anyway.
  24. set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
  25. # Nsight Tegra Visual Studio Edition takes care of
  26. # prefixing library names with '-l'.
  27. if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
  28. set(CMAKE_LINK_LIBRARY_FLAG "")
  29. endif()
  30. # Commonly used Android toolchain files that pre-date CMake upstream support
  31. # set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
  32. if(CMAKE_SYSTEM_VERSION EQUAL 1)
  33. return()
  34. endif()
  35. # Include the NDK hook.
  36. # It can be used by NDK to inject necessary fixes for an earlier cmake.
  37. if(CMAKE_ANDROID_NDK)
  38. include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/post/Android.cmake OPTIONAL)
  39. endif()