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

qt_generate_deploy_app_script(): Handle applications libraries and plugins

XMLWordPrintable

    • Icon: User Story User Story
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Build System: CMake
    • None

      Consider adding options to pass application libraries and plugins to qt_generate_deploy_app_script().

      Use Case

      Due to differences in platforms, the deployment of applications consisting of several binaries (executable, dynamically linked libraries, and plugins loaded at runtime) is messy. The only platform where CMake does give sane defaults with GNUInstallDirs is Unix; Windows and macOS (App Bundles) need manual tweaking, see e.g.

      https://code.qt.io/cgit/qt/qtdoc.git/tree/examples/demos/documentviewer/app/CMakeLists.txt?h=6.10

      #
      # installation
      #
      
      if(APPLE)
          set(INSTALL_LIBDIR "Document Viewer.app/Contents/Frameworks")
          set(INSTALL_PLUGINSDIR "Document Viewer.app/Contents/PlugIns")
      elseif(WIN32)
          set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
          set(INSTALL_LIBDIR ${CMAKE_INSTALL_BINDIR})
          set(INSTALL_PLUGINSDIR "plugins")
      else()
          set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR})
          set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
          set(INSTALL_PLUGINSDIR "plugins")
      endif()
      
      install(TARGETS documentviewer abstractviewer
          BUNDLE DESTINATION .
          RUNTIME DESTINATION "${INSTALL_BINDIR}"
          LIBRARY DESTINATION "${INSTALL_LIBDIR}"
      )
      
      install(TARGETS ${plugin_targets}
          DESTINATION "${INSTALL_PLUGINSDIR}"
      )
      
      # Install Qt libraries and plugins
      qt_generate_deploy_app_script(
          TARGET documentviewer
          OUTPUT_SCRIPT deploy_script
          NO_UNSUPPORTED_PLATFORM_ERROR
          NO_TRANSLATIONS
      )
      
      install(SCRIPT ${deploy_script})
      

      qt_generate_deploy_app_script() does already handle Qt plugins and libraries correctly. Can it be extended to also handle the installation of application libraries and plugins?

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

            qtbuildsystem Qt Build System Team
            kkohne Kai Köhne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes