Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-107803

Qt5.x: Android Cmake project and library name must not differ for deploy to work

    XMLWordPrintable

Details

    • Android, Linux/X11, Windows

    Description

      I noticed that the android apk deploy code seems to always search for an android binary with the same name as the (topmost) CMake project.
      So something like this does not seem to work:

      cmake_minimum_required(VERSION 3.5)
      
      project(ProjectName LANGUAGES CXX)
      
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      set(CMAKE_CXX_STANDARD 11)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      find_package(Qt5 COMPONENTS Core Quick REQUIRED)
      
      if(ANDROID)
      	add_library(AppName SHARED main.cpp qml.qrc)
      endif()
      
      target_compile_definitions(AppName PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
      target_link_libraries(AppName PRIVATE Qt5::Core Qt5::Quick)
      

      My actual use-case is cmake with subprojects (similar to this), when application name and project name (in the subproject) match. The deploy code seems to only respect the topmost project() call in CMake.

      Would it be possible (if it does not already exists), to instead introduce a new CMake call like add_android_app(...), which allows the IDE to unmistakenly identify android apps with the CMake build system?

      Attachments

        1. QTCREATORBUG-25030.zip
          9 kB
          Alessandro Portale
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            seijikun Markus Ebner
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes