Reputation: 4232
I would like to link a different C++ library based on the ABI. I have one version of the lib that works on x86 and one that works on armeabi-v7a. How can I achieve this in Android Studio?
I could not get the solution by googling and I am new to CMake and Gradle. Android as a whole tbh :) So any help is greatly appreciated.
Upvotes: 2
Views: 415
Reputation: 4232
I managed to slove it this way:
set (libs_list "commonLib1" "commonLib2")
if (${ANDROID_ABI} STREQUAL "armeabi-v7a")
set(libs_list ${libs_list} "armLib")
elseif ((${ANDROID_ABI} STREQUAL "x86") OR (${ANDROID_ABI} STREQUAL "x86_64"))
set(libs_list ${LIBRARIES_LIST} "x86Lib")
endif()
target_link_libraries(native_lib ${libs_list})
Upvotes: 2