diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -779,6 +779,10 @@ # (e.g. `printfw`/`scanfw`) target_link_libraries(${target} PRIVATE iso_stdio_wide_specifiers) endif() + + if (ANDROID AND ANDROID_PLATFORM_LEVEL LESS 21) + target_link_libraries(${target} PUBLIC android_support) + endif() endfunction() # Windows-related flags ======================================================= diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -95,6 +95,9 @@ # MINGW_LIBRARIES is defined in config-ix.cmake list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES}) endif() +if (ANDROID AND ANDROID_PLATFORM_LEVEL LESS 21) + list(APPEND LIBCXXABI_LIBRARIES android_support) +endif() if (NOT LIBCXXABI_USE_COMPILER_RT) add_library_flags_if(LIBCXXABI_HAS_GCC_LIB gcc)