global_flags.linker.gnu.cmake 963 B

12345678910111213141516171819202122232425
  1. if (ANDROID)
  2. # NDK r23 onwards has stopped using libgcc:
  3. # - https://github.com/android/ndk/wiki/Changelog-r23#changes
  4. # - https://github.com/android/ndk/issues/1230
  5. # LLVM's libunwind is now used instead of libgcc for all architectures rather than just 32-bit Arm.
  6. # - https://github.com/android/ndk/issues/1231
  7. # LLVM's libclang_rt.builtins is now used instead of libgcc.
  8. if (CMAKE_ANDROID_NDK_VERSION GREATER_EQUAL 23)
  9. # Use toolchain defaults to link with libunwind/clang_rt.builtins
  10. add_link_options("-nostdlib++")
  11. else ()
  12. # Preserve old behaviour: specify runtime libs manually
  13. add_link_options(-nodefaultlibs)
  14. link_libraries(gcc)
  15. if (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
  16. link_libraries(unwind)
  17. endif()
  18. endif()
  19. elseif (CMAKE_SYSTEM_NAME MATCHES "^(Darwin|Linux)$")
  20. add_link_options("-nodefaultlibs")
  21. endif()
  22. if (APPLE)
  23. set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
  24. endif()