diff options
author | Haibo Huang <hhb@google.com> | 2020-10-30 03:29:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-11-04 19:21:26 (GMT) |
commit | 4dca07882944ec5c1d87edf1b7df9f3c7294e0d0 (patch) | |
tree | 18cf6ef3bf33e1972df2d7460bf91890e194bf94 /Modules/Platform/Android-Common.cmake | |
parent | 738caa4d488375a3b20921b366b86b6614bdc769 (diff) | |
download | CMake-4dca07882944ec5c1d87edf1b7df9f3c7294e0d0.zip CMake-4dca07882944ec5c1d87edf1b7df9f3c7294e0d0.tar.gz CMake-4dca07882944ec5c1d87edf1b7df9f3c7294e0d0.tar.bz2 |
Android: Link c++abi and android_support when necessary
For older NDKs we used `__android_stl_lib` to link these libraries, but
the `CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED` code path does not use that.
Link the libraries the way the NDK toolchain file does:
https://android.googlesource.com/platform/ndk/+/43b2de34ef9e3a70573fe51a9e069f985a4be5b9/build/cmake/android.toolchain.cmake#368
Diffstat (limited to 'Modules/Platform/Android-Common.cmake')
-rw-r--r-- | Modules/Platform/Android-Common.cmake | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index bd41a9c..39da933 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -53,6 +53,12 @@ if(CMAKE_ANDROID_STL_TYPE) set(_ANDROID_STL_RTTI 0) macro(__android_stl lang) string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libstdc++") + if(_ANDROID_STL_EXCEPTIONS OR _ANDROID_STL_RTTI) + string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -lc++abi") + if(CMAKE_SYSTEM_VERSION LESS 21) + list(APPEND CMAKE_${lang}_STANDARD_LIBRARIES "-landroid_support") + endif() + endif() endmacro() elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "c++_static") set(_ANDROID_STL_EXCEPTIONS 1) |