Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.0
-
-
b94b7687b0635ee74a3ccd83a234ead0600fd47f (qt/qtbase/dev) 3c8d95afa56e9787f222086b1918616aeb9d5337 (qt/qtbase/6.0), 5e00c0c5e (dev), 24a88bddc (6.5)
Description
qt6_add_executable()
automatically immediately calls
qt_android_generate_deployment_settings()
when targeting Android.
That function reads properties off the executable target, like
QT_ANDROID_PACKAGE_SOURCE_DIR QT_ANDROID_EXTRA_PLUGINS
etc.
The user project has no opportunity to set these properties, because properties can't be set on a target doesn't exist. And trying to set them after the qt6_add_executable call is too late.
A workaround, is to manually call the qt6_android_generate_deployment_settings function after calling qt6_add_executable, and setting the necessary properties.
Thus, the existing qt6_add_executable API is suboptimal.
But the available options to change it are also suboptimal, and we need to pick one that we consider is the best one going forward.
Possible options
- Change qt6_add_executable not to call qt_android_generate_deployment_settings automatically in its implementation, so you can set the properties after qt_add_executable, and then call the function manually. Downside is, user needs to know to call the function manually.
- allow additional options to qt6_add_executable, which would set the properties inside its implementation, so the automatic call of qt_android_generate_deployment_settings find what it needs. This is a suboptimal solution API wise, because it will bloat the list of options that qt_add_executable is supposed to take
- Use CMake 3.19's cmake_language(DEFER CALL) to defer the call to the android deployment json file generation. We can't use this always because minimum CMake version to use Qt is 3.14.
- Use the approach from Qt5, where instead of setting target properties, a user project will have to set CMake variables like set(QT_ANDROID_PACKAGE_SOURCE_DIR"${CMAKE_CURRENT_SOURCE_DIR}/android") before the qt_add_executable call. Downside is that it pollutes the project directory and subdirectories, and is not tied to a target.
Attachments
Issue Links
- relates to
-
QTBUG-86669 Investigate automatic calling of qt6_import_qml_plugins for examples using a static Qt build
- Closed
- resulted in
-
QTBUG-88506 tst_Android::assetsRead fails on Android
- Closed