diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 8a129c2e13c0..9e84fa71a32b 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -779,6 +779,10 @@ function(cxx_link_system_libraries target) # (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 index b584bde8c668..965b1e223830 100644 --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -95,6 +95,9 @@ if (MINGW) # 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)