From adb265a454ce16ca34ef910e21309b7cf333a5b0 Mon Sep 17 00:00:00 2001 From: hong19860320 <9973393+hong19860320@users.noreply.github.com> Date: Fri, 24 Jul 2020 15:39:22 +0800 Subject: [PATCH] [Cherry-pick][Compile] Fix the compiling of full publish with clang and c++_static for android (#3981) (#3989) test=develop --- cmake/cross_compiling/android.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/cross_compiling/android.cmake b/cmake/cross_compiling/android.cmake index b89eed64a8..68f91fe881 100644 --- a/cmake/cross_compiling/android.cmake +++ b/cmake/cross_compiling/android.cmake @@ -83,10 +83,14 @@ if (ARM_TARGET_LANG STREQUAL "clang") if(ANDROID_STL_TYPE MATCHES "^c\\+\\+_") # Use CMAKE_CXX_STANDARD_LIBRARIES_INIT to ensure libunwind and libc++ is linked in the right order set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_CXX_STANDARD_LIBRARIES_INIT} ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ARCH_ABI}/libunwind.a") + if (ANDROID_API_LEVEL LESS 21) + set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_CXX_STANDARD_LIBRARIES_INIT} ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ARCH_ABI}/libandroid_support.a") + endif() if(ANDROID_STL_TYPE STREQUAL "c++_shared") set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_CXX_STANDARD_LIBRARIES_INIT} ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ARCH_ABI}/libc++_shared.so") elseif(ANDROID_STL_TYPE STREQUAL "c++_static") set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_CXX_STANDARD_LIBRARIES_INIT} ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ARCH_ABI}/libc++_static.a") + set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_CXX_STANDARD_LIBRARIES_INIT} ${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ARCH_ABI}/libc++abi.a") else() message(FATAL_ERROR "Invalid Android STL TYPE: ${ANDROID_STL_TYPE}.") endif() -- GitLab