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

Provide an add_application function which would call add_executable or add_library depending on platform

XMLWordPrintable

    • Icon: User Story User Story
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Build System: CMake

      Qt application developers that use CMake and want to write an application targeting both iOS and Android end up having to write:

      if(ANDROID)
        add_library(MyApp)
      elseif(APPLE)
        add_executable(MyApp)
      endif()
      

      This is because on Android, the native C++ part of the application ends up being compiled into a shared library, which is then dynamically loaded (dlopened) by the appropriate .jar / Java runtime.

      Instead of forcing users to write these if() conditions, it would be nice if CMake provided a function called add_application which hides the conditional logic inside the function body.

      Related upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/20864

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qtbuildsystem Qt Build System Team
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes