CMake is known for building one configuration at a time, that's true for single configuration generators (Makefiles / Ninja), or multi-configuration generators (Visual Studio / Xcode). However, by using ExternalProject one can build the same project multiple times with different configurations in one go.
Qt 5.14 has gotten support for this scenario, however it didn't make it into Qt 5.14 beta 2! The Android plugin in Qt Creator has been also updated. The Qt 5.14 release should contain all the necessary changes to create / build / deploy Qt Android applications using CMake.
Let's say we created a Qt Quick CMake project, if we go to the Build Settings we can see in the CMake variable list the following:
One can select which ABI gets to be built by clicking the corresponding ANDROID_BUILD_ABI_<abi> check boxes.
From command line, the CMake project will also get the apk and aab targets, which can be used to generate the corresponding Android package.
CMake 3rd party packages
Qt 5.14 will come with a multi ABI installation, but what about 3rd party packages?
The CMake ecosystem has a few packages managers e.g. conan, vcpkg, Hunter. All of the packages managers have some dependencies, and need some sort of external configuration. The amount of configuration gets more complicated when you have to support the multiple ABIs of Android!
With Hunter, since it only depends on CMake, I was able to get the setup down to few lines lines of CMake code, which works with the new Qt for Android multi ABI setup.
For example, let's say we would want to create an application which does face detection, we could pick the dlib library, which has an example for this task.
In order to get dlib for my project all I have to do in my CMake code is:
# Setting up dlib as an external package set(HUNTER_PACKAGES dlib)
# Using the dlib package find_package(dlib REQUIRED) target_link_libraries(myapp PRIVATE dlib::dlib)
The initial configuration will take some time, since dlib has giflib, Jpeg, PNG, sqlite3, ZLIB as dependencies, which will get compiled with the current compiler / ABI. But once cached for a certain configuration, the CMake configuration / build would be as fast as with other pre-built library.