Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cmake settings for Android extras
QtWS25 Last Chance

Cmake settings for Android extras

Scheduled Pinned Locked Moved Solved Mobile and Embedded
2 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maydin
    wrote on last edited by
    #1

    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
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      maydin
      wrote on last edited by
      #2

      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)
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved