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

Document installation of custom plugins using CMake.

XMLWordPrintable

      The CMake manual does not cover the installation of custom QtDesigner plugins. FindQt4 used to supply the QT_PLUGINS_DIR variable, but there doesn't seem to exist a Qt5 equivalent. I ended up doing the following, which may be worth including in the manual:

      #Install the designer plugin
      if(QT_PLUGINS_DIR)
        # Legacy FindQt4.
        install(TARGETS ${Library}
          RUNTIME DESTINATION "${QT_PLUGINS_DIR}/designer"
        )
      else()
        # Call qmake to query the plugin installation directory.
        get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake LOCATION)
        execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
          OUTPUT_VARIABLE QT_INSTALL_PLUGINS OUTPUT_STRIP_TRAILING_WHITESPACE
        )
        install(TARGETS ${Library}
          RUNTIME DESTINATION "${QT_INSTALL_PLUGINS}/designer"
        )
      endif()
      

      Better yet, Qt's CMake files could reintroduce the QT_PLUGINS_DIR. Anyway, it should be documented.

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

            qtbuildsystem Qt Build System Team
            veelo Bastiaan Veelo
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes