DeployQt4

Note

This module is for Qt version 4. New code should follow the cmake-qt(7) instead of using this module.

This module provides a collection of CMake utility commands useful for assembling and deploying standalone Qt4 executables.

Load this module in a CMake project with:

include(DeployQt4)

Commands

This module provides the following commands:

write_qt4_conf

Creates a Qt configuration file:

write_qt4_conf(<qt-conf-dir> <qt-conf-contents>)

This command writes a qt.conf file with the <qt-conf-contents> into the <qt-conf-dir> directory.

resolve_qt4_paths

Resolves relative paths to absolute:

resolve_qt4_paths(<paths-var> [<executable-path>])

This command loops through the <paths-var> list and if any path doesn't exist, it resolves them relative to the <executable-path> (if supplied) or the CMAKE_INSTALL_PREFIX.

fixup_qt4_executable

Fixes up a Qt4 executable:

fixup_qt4_executable(
  <executable>
  [<qtplugins> <libs> <dirs> <plugins-dir> <request-qt-conf>]
)

This command copies Qt plugins, writes a Qt configuration file (if needed) and fixes up a Qt4 executable using the BundleUtilities module so it is standalone and can be drag-and-drop copied to another machine as long as all of the system libraries are compatible.

<executable> should point to the executable to be fixed-up.

<qtplugins> should contain a list of the names or paths of any Qt plugins to be installed.

<libs> will be passed to the BundleUtilities module and should be a list of any already installed plugins, libraries or executables to also be fixed-up.

<dirs> will be passed to the BundleUtilities module and should contain directories to be searched to find library dependencies.

<plugins-dir> allows a custom plugins directory to be used.

<request-qt-conf> will force a qt.conf file to be written even if not needed.

install_qt4_plugin_path

Installs a resolved Qt4 plugin:

install_qt4_plugin_path(
  <plugin>
  <executable>
  <copy>
  <installed-plugin-path-var>
  [<plugins-dir> <component> <configurations>]
)

This command installs (or copies) a resolved <plugin> to the default plugins directory (or <plugins-dir>) relative to <executable> and stores the result in a variable <installed-plugin-path-var>.

If <copy> is set to TRUE then the plugins will be copied rather than installed. This is to allow this module to be used at CMake time rather than install time.

If <component> is set then anything installed will use this COMPONENT.

install_qt4_plugin

Installs an unresolved Qt4 plugin:

install_qt4_plugin(
  <plugin>
  <executable>
  <copy>
  <installed-plugin-path-var>
  [<plugins-dir> <component>]
)

This command installs (or copies) an unresolved <plugin> to the default plugins directory (or <plugins-dir>) relative to <executable> and stores the result in a variable <installed-plugin-path-var>. For other arguments, see also install_qt4_plugin_path().

install_qt4_executable

Installs Qt plugins, writes a Qt configuration file (if needed) and fixes up a Qt4 executable:

install_qt4_executable(
  <executable>
  [<qtplugins> <libs> <dirs> <plugins-dir> <request-qt-conf> <component>]
)

This command uses the BundleUtilities module so executable is standalone and can be drag-and-drop copied to another machine as long as all of the system libraries are compatible. The executable will be fixed-up at install time. The <component> is the COMPONENT used for bundle fixup and plugin installation. For other arguments, see also fixup_qt4_executable().