No, you cannot have CMakeLists.txt paths for different tastes and / or ABIs, but you can use arguments to add conditional expressions in a cmake script, for example, as follows:
flavorDimensions "abi" productFlavors { arm64_v8a { dimension "abi" ndk { abiFilters "arm64-v8a" } externalNativeBuild { cmake { parameters "-DFLAVOR=ARM" } } } x86_64 { dimension "abi" ndk { abiFilters "x86_64" } externalNativeBuild { cmake { parameters "-DFLAVOR=ARM" } } } }
Now you can check this in your CMakeLists.txt file :
if (FLAVOR STREQUAL 'ARM') include(arm.cmake) endif()
But in your case, you can rely on the argument that is defined by Android Studio, and you do not need your own parameter:
if (ANDROID_ABI STREQUAL 'arm64-v8a') include(arm.cmake) endif()
Actually, you probably don't need a separate productFlavor , but use splits to create thin APKs for each ABI.
source share