Qmake plugin

The qmake plugin configures projects using qmake, and builds them by processing the project files files to be run with using GNU Make.

After a successful build, this plugin will install the generated binaries in $CRAFT_PART_INSTALL.

Keys

This plugin provides the following unique keys.

qmake-parameters

Type

list[str]

Description

The parameters to pass to qmake.

qmake-project-file

Type

str

Description

The path to the qmake project file to use.

This key is usually only needed if qmake can’t determine the project file automatically. If the source-subdir key is set and the value already starts with that prefix, the path is resolved relative to the source directory. Otherwise, it’s resolved relative to the source subdirectory.

qmake-major-version

Type

int

Description

The major version of Qt to use.

Defaults to 5.

Environment variables

The plugin sets the QT_SELECT environment variable to qmake-major-version.

Dependencies

The qmake plugin needs the qmake executable to configure, and the make executable to build. These dependencies are provided by the plugin as a build-packages entry.

The plugin also sets up g++. Other compiler or library dependencies the source requires to build are to be provided.

How it works

During the build step the plugin performs the following actions:

  1. Run qmake in the build directory to setup the Makefiles, the project is configured with any qmake-parameters that might have been set. If qmake-project-file has been set, qmake refers to the defined file to configure the project.

  2. make is run to build the source.

  3. make calls the install target with DESTDIR set to $CRAFT_PART_INSTALL.

Example

The following snippet declares a part using the qmake plugin for a local source that contains a .pro project file. It specifies that the major Qt version is 6, and that the project should be built with the Debug configuration:

parts:
  hello:
    source: .
    plugin: qmake
    qmake-major-version: 6
    qmake-parameters:
      - "CONFIG+=debug"