QMake Manual

Advanced Usage

Adding New Configuration Features

Installing Files

Adding Custom Targets

Adding Compilers

Library Dependencies

Building Common Project Types

Building an Application

Building a Testcase

Building a Library

Building a Plugin

Building a Qt Widgets Designer Plugin

Building and Installing in Debug and Release Modes

Building in Both Modes

Installing in Both Modes

Configuring qmake

Properties

QMAKESPEC

Cache File

File Extensions

Creating Project Files

Project File Elements

Variables

Whitespace

Comments

Built-in Functions and Control Flow

Project Templates

General Configuration

Declaring Qt Libraries

Configuration Features

Declaring Other Libraries

Getting Started with qmake

Starting Off Simple

Making an Application Debuggable

Adding Platform-Specific Source Files

Stopping qmake If a File Does Not Exist

Checking for More than One Condition

Overview

Describing a project

Building a project

Adding third-party libraries

Precompiling headers

Platform Notes

macOS, iOS, tvOS, and watchOS

Source and Binary Packages

Using Frameworks

Creating Frameworks

Creating and Moving Xcode Projects

Supporting Two Build Targets Simultaneously

Windows

Adding Windows Resource Files

Creating Visual Studio Project Files

Visual Studio Manifest Files

QMake module topics

Reference

Variable Reference

Function Reference

Replace Functions

qmake Function Reference - Replace Functions

Built-in Replace Functions

absolute_path(path[, base])

basename(variablename)

cat(filename[, mode])

clean_path(path)

dirname(file)

enumerate_vars

escape_expand(arg1 [, arg2 ..., argn])

find(variablename, substr)

files(pattern[, recursive=false])

first(variablename)

format_number(number[, options...])

fromfile(filename, variablename)

getenv(variablename)

join(variablename, glue, before, after)

last(variablename)

list(arg1 [, arg2 ..., argn])

lower(arg1 [, arg2 ..., argn])

member(variablename [, start [, end]])

num_add(arg1 [, arg2 ..., argn])

prompt(question [, decorate])

quote(string)

re_escape(string)

read_registry(tree, key[, flag])

relative_path(filePath[, base])

replace(string, old_string, new_string)

resolve_depends(variablename, prefix)

reverse(variablename)

section(variablename, separator, begin, end)

shadowed(path)

shell_path(path)

shell_quote(arg)

size(variablename)

sort_depends(variablename, prefix)

sorted(variablename)

split(variablename, separator)

sprintf(string, arguments...)

str_member(arg [, start [, end]])

str_size(arg)

system(command[, mode[, stsvar]])

system_path(path)

system_quote(arg)

take_first(variablename)

take_last(variablename)

unique(variablename)

upper(arg1 [, arg2 ..., argn])

val_escape(variablename)

Running qmake

Command Syntax

Operating Modes

Files

General Options

Makefile Mode Options

Project Mode Options

Test Functions

qmake Function Reference - Test Functions

Built-in Test Functions

cache(variablename, [set|add|sub] [transient] [super|stash], [source variablename])

CONFIG(config)

contains(variablename, value)

count(variablename, number)

debug(level, message)

defined(name[, type])

equals(variablename, value)

error(string)

eval(string)

exists(filename)

export(variablename)

for(iterate, list)

greaterThan(variablename, value)

if(condition)

include(filename)

infile(filename, var, val)

isActiveConfig

isEmpty(variablename)

isEqual

lessThan(variablename, value)

load(feature)

log(message)

message(string)

mkpath(dirPath)

requires(condition)

system(command)

touch(filename, reference_filename)

unset(variablename)

versionAtLeast(variablename, versionNumber)

versionAtMost(variablename, versionNumber)

warning(string)

write_file(filename, [variablename, [mode]])

Test Function Library

packagesExist(packages)

prepareRecursiveTarget(target)

qtCompileTest(test)

qtHaveModule(name)

Using Precompiled Headers

Adding Precompiled Headers to Your Project

Project Options

Notes on Possible Issues

Example Project

mydialog<@op>.</@op>ui

stable<@op>.</@op>h

myobject<@op>.</@op>h

myobject<@op>.</@op>cpp

util<@op>.</@op>cpp

main<@op>.</@op>cpp

precompile<@op>.</@op>pro

Using Third-Party Libraries

Source Code

Library Files

Destination Directory

Variables

qmake Variable Reference

ANDROID_ABIS

ANDROID_API_VERSION

ANDROID_APPLICATION_ARGUMENTS

ANDROID_BUNDLED_JAR_DEPENDENCIES

ANDROID_DEPLOYMENT_DEPENDENCIES

ANDROID_DEPLOYMENT_SETTINGS_FILE

ANDROID_EXTRA_LIBS

ANDROID_EXTRA_PLUGINS

ANDROID_FEATURES

ANDROID_LIB_DEPENDENCIES

ANDROID_MIN_SDK_VERSION

ANDROID_PACKAGE_SOURCE_DIR

ANDROID_PERMISSIONS

ANDROID_TARGET_SDK_VERSION

ANDROID_VERSION_CODE

ANDROID_VERSION_NAME

CONFIG

DEFINES

DEFINES_DEBUG

DEFINES_RELEASE

DEF_FILE

DEPENDPATH

DESTDIR

DISTFILES

DLLDESTDIR

EXTRA_TRANSLATIONS

FORMS

GUID

HEADERS

ICON

IDLSOURCES

INCLUDEPATH

INSTALLS

JAVA_HOME

LEXIMPLS

LEXOBJECTS

LEXSOURCES

LIBS

LIBS_PRIVATE

LITERAL_HASH

MAKEFILE

MAKEFILE_GENERATOR

MSVCPROJ_*

MOC_DIR

OBJECTIVE_HEADERS

OBJECTIVE_SOURCES

OBJECTS

OBJECTS_DIR

POST_TARGETDEPS

PRE_TARGETDEPS

PRECOMPILED_HEADER

PWD

OUT_PWD

QM_FILES_RESOURCE_PREFIX

QM_FILES_INSTALL_PATH

QML_IMPORT_PATH

QMLPATHS

QMAKE

QMAKESPEC

QMAKE_APPLE_DEVICE_ARCHS

QMAKE_AR_CMD

QMAKE_BUNDLE_DATA

QMAKE_BUNDLE_EXTENSION

QMAKE_CC

QMAKE_CFLAGS

QMAKE_CFLAGS_DEBUG

QMAKE_CFLAGS_RELEASE

QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO

QMAKE_CFLAGS_SHLIB

QMAKE_CFLAGS_THREAD

QMAKE_CFLAGS_WARN_OFF

QMAKE_CFLAGS_WARN_ON

QMAKE_CLEAN

QMAKE_CXX

QMAKE_CXXFLAGS

QMAKE_CXXFLAGS_DEBUG

QMAKE_CXXFLAGS_RELEASE

QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO

QMAKE_CXXFLAGS_SHLIB

QMAKE_CXXFLAGS_THREAD

QMAKE_CXXFLAGS_WARN_OFF

QMAKE_CXXFLAGS_WARN_ON

QMAKE_DEVELOPMENT_TEAM

QMAKE_DISTCLEAN

QMAKE_EXTENSION_SHLIB

QMAKE_EXTENSION_STATICLIB

QMAKE_EXT_MOC

QMAKE_EXT_UI

QMAKE_EXT_PRL

QMAKE_EXT_LEX

QMAKE_EXT_YACC

QMAKE_EXT_OBJ

QMAKE_EXT_CPP

QMAKE_EXT_H

QMAKE_EXTRA_COMPILERS

QMAKE_EXTRA_TARGETS

QMAKE_FAILED_REQUIREMENTS

QMAKE_FRAMEWORK_BUNDLE_NAME

QMAKE_FRAMEWORK_VERSION

QMAKE_HOST

QMAKE_INCDIR

QMAKE_INCDIR_EGL

QMAKE_INCDIR_OPENGL

QMAKE_INCDIR_OPENGL_ES2

QMAKE_INCDIR_OPENVG

QMAKE_INCDIR_X11

QMAKE_INFO_PLIST

QMAKE_IOS_DEPLOYMENT_TARGET

QMAKE_IOS_LAUNCH_SCREEN

QMAKE_LFLAGS

QMAKE_LFLAGS_CONSOLE

QMAKE_LFLAGS_DEBUG

QMAKE_LFLAGS_PLUGIN

QMAKE_LFLAGS_RPATH

QMAKE_LFLAGS_REL_RPATH

QMAKE_REL_RPATH_BASE

QMAKE_LFLAGS_RPATHLINK

QMAKE_LFLAGS_RELEASE

QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO

QMAKE_LFLAGS_APP

QMAKE_LFLAGS_SHLIB

QMAKE_LFLAGS_SONAME

QMAKE_LFLAGS_THREAD

QMAKE_LFLAGS_WINDOWS

QMAKE_LIBDIR

QMAKE_LIBDIR_POST

QMAKE_LIBDIR_FLAGS

QMAKE_LIBDIR_EGL

QMAKE_LIBDIR_OPENGL

QMAKE_LIBDIR_OPENVG

QMAKE_LIBDIR_X11

QMAKE_LIBS

QMAKE_LIBS_PRIVATE

QMAKE_LIBS_EGL

QMAKE_LIBS_OPENGL

QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES2

QMAKE_LIBS_OPENVG

QMAKE_LIBS_THREAD

QMAKE_LIBS_X11

QMAKE_LIB_FLAG

QMAKE_LINK

QMAKE_LINK_SHLIB_CMD

QMAKE_LN_SHLIB

QMAKE_LRELEASE_FLAGS

QMAKE_OBJECTIVE_CFLAGS

QMAKE_POST_LINK

QMAKE_PRE_LINK

QMAKE_PROJECT_NAME

QMAKE_PROVISIONING_PROFILE

QMAKE_MAC_SDK

QMAKE_MACOSX_DEPLOYMENT_TARGET

QMAKE_MAKEFILE

QMAKE_QMAKE

QMAKE_RESOURCE_FLAGS

QMAKE_RPATHDIR

QMAKE_RPATHLINKDIR

QMAKE_RUN_CC

QMAKE_RUN_CC_IMP

QMAKE_RUN_CXX

QMAKE_RUN_CXX_IMP

QMAKE_SONAME_PREFIX

QMAKE_TARGET

QMAKE_TARGET_COMPANY

QMAKE_TARGET_DESCRIPTION

QMAKE_TARGET_COPYRIGHT

QMAKE_TARGET_PRODUCT

QMAKE_TARGET_ORIGINAL_FILENAME

QMAKE_TARGET_INTERNALNAME

QMAKE_TARGET_COMMENTS

QMAKE_TARGET_TRADEMARKS

QMAKE_MANIFEST

QMAKE_TVOS_DEPLOYMENT_TARGET

QMAKE_UIC_FLAGS

QMAKE_WATCHOS_DEPLOYMENT_TARGET

QML_IMPORT_MAJOR_VERSION

QML_IMPORT_MINOR_VERSION

QML_IMPORT_VERSION

QML_IMPORT_NAME

QML_FOREIGN_METATYPES

QT

QTPLUGIN

QT_VERSION

QT_MAJOR_VERSION

QT_MINOR_VERSION

QT_PATCH_VERSION

RC_FILE

RC_CODEPAGE

RC_DEFINES

RC_ICONS

RC_LANG

RC_INCLUDEPATH

RCC_DIR

REQUIRES

RESOURCES

RES_FILE

SOURCES

SUBDIRS

TARGET

TARGET_EXT

TARGET_x

TARGET_x.y.z

TEMPLATE

TRANSLATIONS

TR_EXCLUDE

UI_DIR

VERSION

VERSION_PE_HEADER

VER_MAJ

VER_MIN

VER_PAT

VPATH

WINDOWS_TARGET_PLATFORM_VERSION

WINDOWS_TARGET_PLATFORM_MIN_VERSION

YACCSOURCES

_PRO_FILE_

_PRO_FILE_PWD_

qmake Language

Operators

Assigning Values

Appending Values

Removing Values

Adding Unique Values

Replacing Values

Variable Expansion

Accessing qmake Properties

Scopes

Scope Syntax

Scopes and Conditions

Configuration and Scopes

Platform Scope Values

Variables

Replace Functions

Test Functions

qmake Manual

Table of Contents