Cmake settings for Android extras
Solved
Mobile and Embedded
-
I want to build a project that uses Java code for my Qt application. MusicList example from Android Extras uses qmake but I need equivalent settings for Cmake.
These are qmake properties for MusicList example, how can I setup CMake to use Java code as in this example?
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android DISTFILES += \ android/AndroidManifest.xml \ android/src/org/qtproject/example/musiclist/MusicList.java
-
Somehow my eyes didn't see comment in Cmake file. Just uncomment this, find package and link against AndroidExtras and it works.
set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") ... find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick LinguistTools AndroidExtras REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick LinguistTools AndroidExtras REQUIRED) ... target_link_libraries(App PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::AndroidExtras)