Adding Assets To Android Build Using CMake
-
I am using CMake to build an android application and want to add a plain .ini file to the assets folder, then access it from C++.
This page in the Qt6 documentation describes only the qmake .pro file way to do this.
What would be the correct way to do this using CMake?
-
@KenAppleby-0
https://doc.qt.io/qt-6/android-platform-notes.html#assets-file-systemIt seems you can set
QT_ANDROID_PACKAGE_SOURCE_DIR
variable and add the folder assets. Then according tothisEdit thisThe path specified by this variable can contain custom Java classes under src directory. By default, the androiddeployqt tool copies the application template from the Qt for Android installation path into your project's build directory, then it copies the contents of the path specified by this variable on top of that, overwriting any existing files. For instance, you can make a custom AndroidManifest.xml for your application, then place this directly into the directory specified by this variable.
In CMake add
set_property(TARGET yourtarget PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
And put your assets folder under
${CMAKE_CURRENT_SOURCE_DIR}/android
-
-
@KenAppleby-0
https://doc.qt.io/qt-6/android-platform-notes.html#assets-file-systemIt seems you can set
QT_ANDROID_PACKAGE_SOURCE_DIR
variable and add the folder assets. Then according tothisEdit thisThe path specified by this variable can contain custom Java classes under src directory. By default, the androiddeployqt tool copies the application template from the Qt for Android installation path into your project's build directory, then it copies the contents of the path specified by this variable on top of that, overwriting any existing files. For instance, you can make a custom AndroidManifest.xml for your application, then place this directly into the directory specified by this variable.
In CMake add
set_property(TARGET yourtarget PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
And put your assets folder under
${CMAKE_CURRENT_SOURCE_DIR}/android
-
K KenAppleby 0 has marked this topic as solved on