I'm trying to build my project, which consists of an app and a few libraries, for Android. I'm building with CMake, there's no qmake nor QtCreator.
I get the following error at configure time:
CMake Error at C:/dev/qt/5.15.1/android/lib/cmake/Qt5Core/Qt5AndroidSupport.cmake:126 (add_custom_target):
add_custom_target cannot create target "apk" because another target with
the same name already exists. The existing target is a custom target
created in source directory "my-project". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
It seems that Qt5AndroidSupport.cmake creates two custom CMake targets ("apk" and "aab") whenever it is included by a call to find_package(Qt). Therefore, multiple calls to find_package(Qt) produce this error, as it tries to create the "apk" and "aab" targets multiple times.
All this was previously working with Qt 5.13.1.