Contents
- CONFIG
- DEFINES
- DEF_FILE
- DEPENDPATH
- DEPLOYMENT
- DEPLOYMENT_PLUGIN
- DESTDIR
- DISTFILES
- DLLDESTDIR
- FORMS
- GUID
- HEADERS
- ICON
- INCLUDEPATH
- INSTALLS
- LEXIMPLS
- LEXOBJECTS
- LEXSOURCES
- LIBS
- LITERAL_HASH
- MAKEFILE
- MAKEFILE_GENERATOR
- MOC_DIR
- OBJECTS
- OBJECTS_DIR
- POST_TARGETDEPS
- PRE_TARGETDEPS
- PRECOMPILED_HEADER
- PWD
- OUT_PWD
- QMAKE
- QMAKESPEC
- QMAKE_AR_CMD
- QMAKE_BUNDLE_DATA
- QMAKE_BUNDLE_EXTENSION
- QMAKE_CC
- QMAKE_CFLAGS_DEBUG
- QMAKE_CFLAGS_RELEASE
- 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_SHLIB
- QMAKE_CXXFLAGS_THREAD
- QMAKE_CXXFLAGS_WARN_OFF
- QMAKE_CXXFLAGS_WARN_ON
- QMAKE_DISTCLEAN
- QMAKE_EXTENSION_SHLIB
- 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_INCDIR
- QMAKE_INCDIR_EGL
- QMAKE_INCDIR_OPENGL
- QMAKE_INCDIR_OPENGL_ES1, QMAKE_INCDIR_OPENGL_ES2
- QMAKE_INCDIR_OPENVG
- QMAKE_INCDIR_X11
- QMAKE_INFO_PLIST
- QMAKE_LFLAGS
- QMAKE_LFLAGS_CONSOLE
- QMAKE_LFLAGS_DEBUG
- QMAKE_LFLAGS_PLUGIN
- QMAKE_LFLAGS_RPATH
- QMAKE_LFLAGS_RPATHLINK
- QMAKE_LFLAGS_RELEASE
- QMAKE_LFLAGS_APP
- QMAKE_LFLAGS_SHLIB
- QMAKE_LFLAGS_SONAME
- QMAKE_LFLAGS_THREAD
- QMAKE_LFLAGS_WINDOWS
- QMAKE_LIBDIR
- QMAKE_LIBDIR_FLAGS
- QMAKE_LIBDIR_EGL
- QMAKE_LIBDIR_OPENGL
- QMAKE_LIBDIR_OPENVG
- QMAKE_LIBDIR_X11
- QMAKE_LIBS
- 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_SHLIB_CMD
- QMAKE_LN_SHLIB
- QMAKE_POST_LINK
- QMAKE_PRE_LINK
- QMAKE_PROJECT_NAME
- 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_TARGET
- QT
- QTPLUGIN
- QT_VERSION
- QT_MAJOR_VERSION
- QT_MINOR_VERSION
- QT_PATCH_VERSION
- RC_FILE
- RC_INCLUDEPATH
- RCC_DIR
- REQUIRES
- RESOURCES
- RES_FILE
- SIGNATURE_FILE
- SOURCES
- SUBDIRS
- TARGET
- TARGET_EXT
- TARGET_x
- TARGET_x.y.z
- TEMPLATE
- TRANSLATIONS
- UI_DIR
- VERSION
- VER_MAJ
- VER_MIN
- VER_PAT
- VPATH
- YACCSOURCES
- _PRO_FILE_
- _PRO_FILE_PWD_
Variables
The fundamental behavior of qmake is influenced by variable declarations that define the build process of each project. Some of these declare resources, such as headers and source files, that are common to each platform. Others are used to customize the behavior of compilers and linkers on specific platforms.
Platform-specific variables follow the naming pattern of the variables which they extend or modify, but include the name of the relevant platform in their name. For example, QMAKE_LIBS can be used to specify a list of libraries that a project needs to link against, and QMAKE_LIBS_X11 can be used to extend or override this list.
CONFIG
Specifies project configuration and compiler options. The values are recognized internally by qmake and have special meaning.
The following CONFIG values control compilation flags:
Option | Description |
---|---|
release | The project is to be built in release mode. If debug is also specified, the last one takes effect. |
debug | The project is to be built in debug mode. |
debug_and_release | The project is prepared to be built in both debug and release modes. |
debug_and_release_target | This option is set by default. If debug_and_release is also set, the debug and release builds end up in separate debug and release directories. |
build_all | If debug_and_release is specified, the project is built in both debug and release modes by default. |
autogen_precompile_source | Automatically generates a .cpp file that includes the precompiled header file specified in the .pro file. |
ordered | When using the subdirs template, this option specifies that the directories listed should be processed in the order in which they are given. |
precompile_header | Enables support for the use of precompiled headers in projects. |
warn_on | The compiler should output as many warnings as possible. If warn_off is also specified, the last one takes effect. |
warn_off | The compiler should output as few warnings as possible. |
exceptions | Exception support is enabled. Set by default. |
exceptions_off | Exception support is disabled. |
rtti | RTTI support is enabled. By default, the compiler default is used. |
rtti_off | RTTI support is disabled. By default, the compiler default is used. |
stl | STL support is enabled. By default, the compiler default is used. |
stl_off | STL support is disabled. By default, the compiler default is used. |
thread | Thread support is enabled. This is enabled when CONFIG includes qt, which is the default. |
Since the debug option overrides the release option when both are defined in the CONFIG variable, it is necessary to use the debug_and_release option if you want to allow both debug and release versions of a project to be built. In such a case, the Makefile that qmake generates includes a rule that builds both versions, and this can be invoked in the following way:
make all
When linking a library, qmake relies on the underlying platform to know what other libraries this library links against. However, if linking statically, qmake will not get this information unless we use the following CONFIG options:
Option | Description |
---|---|
create_prl | This option enables qmake to track these dependencies. When this option is enabled, qmake will create a file with the extension .prl which will save meta-information about the library (see Library Dependencies for more info). |
link_prl | When this option is enabled, qmake will process all libraries linked to by the application and find their meta-information (see Library Dependencies for more info). |
Note: The create_prl option is required when building a static library, while link_prl is required when using a static library.
On Windows (or if Qt is configured with -debug-and-release), add the build_all option to the CONFIG variable to build all build configurations by default.
Additionally, adding debug_and_release to the CONFIG variable will cause both debug and release to be defined in the contents of CONFIG. When the project file is processed, the scopes that test for each value will be processed for both debug and release modes. The build_pass variable will be set for each of these modes, and you can test for this to perform build-specific tasks. For example:
build_pass:CONFIG(debug, debug|release) { unix: TARGET = $$join(TARGET,,,_debug) else: TARGET = $$join(TARGET,,,d) }
As a result, it may be useful to define mode-specific variables, such as QMAKE_LFLAGS_RELEASE, instead of general variables, such as QMAKE_LFLAGS, where possible.
The following options define the application or library type:
Option | Description |
---|---|
qt | The target is a Qt application or library and requires the Qt library and header files. The proper include and library paths for the Qt library will automatically be added to the project. This is defined by default, and can be fine-tuned with the \l{#qt}{QT} variable. |
thread | The target is a multi-threaded application or library. The proper defines and compiler flags will automatically be added to the project. This value is set by default. |
x11 | The target is a X11 application or library. The proper include paths and libraries will automatically be added to the project. |
testcase | The target is an automated test. A check target will be added to the generated Makefile to run the test. Only relevant when generating Makefiles. |
insignificant_test | The exit code of the automated test will be ignored. Only relevant if testcase is also set. |
windows | The target is a Win32 window application (app only). The proper include paths, compiler flags and libraries will automatically be added to the project. |
console | The target is a Win32 console application (app only). The proper include paths, compiler flags and libraries will automatically be added to the project. |
shared | The target is a shared object/DLL. The proper include paths, compiler flags and libraries will automatically be added to the project. Note that dll can also be used on all platforms; a shared library file with the appropriate suffix for the target platform (.dll or .so) will be created. |
dll | |
static | The target is a static library (lib only). The proper compiler flags will automatically be added to the project. |
staticlib | |
plugin | The target is a plugin (lib only). This enables dll as well. |
designer | The target is a plugin for Qt Designer. |
no_lflags_merge | Ensures that the list of libraries stored in the LIBS variable is not reduced to a list of unique values before it is used. |
resources | Configures qmake to run rcc on the content of RESOURCES if defined. |
These options define specific features on Windows only:
Option | Description |
---|---|
flat | When using the vcapp template this will put all the source files into the source group and the header files into the header group regardless of what directory they reside in. Turning this option off will group the files within the source/header group depending on the directory they reside. This is turned on by default. |
embed_manifest_dll | Embeds a manifest file in the DLL created as part of a library project. |
embed_manifest_exe | Embeds a manifest file in the DLL created as part of an application project. |
incremental | Used to enable or disable incremental linking in Visual C++, depending on whether this feature is enabled or disabled by default. |
See Platform Notes for more information about the options for embedding manifest files.
The following options take an effect only on Mac OS X:
Option | Description |
---|---|
ppc | Builds a PowerPC binary. |
x86 | Builds an i386 compatible binary. |
app_bundle | Puts the executable into a bundle (this is the default). |
lib_bundle | Puts the library into a library bundle. |
The build process for bundles is also influenced by the contents of the QMAKE_BUNDLE_DATA variable.
The following options take an effect only on Linux/Unix platforms:
Option | Description |
---|---|
largefile | Includes support for large files. |
separate_debug_info | Puts debugging information for libraries in separate files. |
The CONFIG variable will also be checked when resolving scopes. You may assign anything to this variable.
For example:
CONFIG += console newstuff ... newstuff { SOURCES += new.cpp HEADERS += new.h }
DEFINES
qmake adds the values of this variable as compiler C preprocessor macros (-D option).
For example:
DEFINES += USE_MY_STUFF
DEF_FILE
Note: This variable is used only on Windows when using the app template.
Specifies a .def file to be included in the project.
DEPENDPATH
Specifies a list of all directories to look in to resolve dependencies. This variable is used when crawling through included files.
DEPLOYMENT
Note: This variable is used only on the Windows CE platform.
Specifies which additional files will be deployed. Deployment means the transfer of files from the development system to the target device or emulator.
Files can be deployed by either creating a Visual Studio project or using the cetest executable.
For example, the following definition uploads all PNG images in path to the directory where the build target is deployed:
myFiles.files = path\*.png DEPLOYMENT += myFiles
The default deployment target path for Windows CE is %CSIDL_PROGRAM_FILES%\target, which usually gets expanded to \Program Files\target.
It is also possible to specify multiple sources to be deployed on target paths. In addition, different variables can be used for deployment to different directories.
For example:
myFiles.files = path\file1.ext1 path2\file2.ext1 path3\* myFiles.path = \some\path\on\device someother.files = C:\additional\files\* someother.path = \myFiles\path2 DEPLOYMENT += myFiles someother
Note: In Windows CE all linked Qt libraries will be deployed to the path specified by myFiles.path.
DEPLOYMENT_PLUGIN
Note: This variable is used only on the Windows CE platform.
Specifies the Qt plugins that will be deployed. All plugins available in Qt can be explicitly deployed to the device. See Static Plugins for a complete list.
Note: No plugins will be deployed automatically to Windows CE devices. If the application depends on plugins, these plugins have to be specified manually.
For example, the following definition uploads the jpeg imageformat plugin to the plugins directory on the Windows CE device:
DEPLOYMENT_PLUGIN += qjpeg
DESTDIR
Specifies where to put the target file.
For example:
DESTDIR = ../../lib
DISTFILES
Specifies a list of files to be included in the dist target. This feature is supported by UnixMake specs only.
For example:
DISTFILES += ../program.txt
DLLDESTDIR
Note: This variable applies only to Windows targets.
Specifies where to copy the target dll.
FORMS
Specifies the UI files (see Qt Designer Manual) to be processed by uic before compiling. All dependencies, headers and source files required to build these UI files will automatically be added to the project.
For example:
FORMS = mydialog.ui \ mywidget.ui \ myconfig.ui
GUID
Specifies the GUID that is set inside a .vcproj file. The GUID is usually randomly determined. However, should you require a fixed GUID, it can be set using this variable.
This variable is specific to .vcproj files only; it is ignored otherwise.
HEADERS
Defines the header files for the project.
qmake automatically detects whether moc is required by the classes in the headers, and adds the appropriate dependencies and files to the project for generating and linking the moc files.
For example:
HEADERS = myclass.h \ login.h \ mainwindow.h
See also SOURCES.
ICON
This variable is used only on Mac OS to set the application icon. Please see the application icon documentation for more information.
INCLUDEPATH
Specifies the #include directories which should be searched when compiling the project.
For example:
INCLUDEPATH = c:/msdev/include d:/stl/include
To specify a path containing spaces, quote the path using the technique described in Whitespace.
win32:INCLUDEPATH += "C:/mylibs/extra headers" unix:INCLUDEPATH += "/home/user/extra headers"
INSTALLS
Specifies a list of resources that will be installed when make install or a similar installation procedure is executed. Each item in the list is typically defined with attributes that provide information about where it will be installed.
For example, the following target.path definition describes where the build target will be installed, and the INSTALLS assignment adds the build target to the list of existing resources to be installed:
target.path += $$[QT_INSTALL_PLUGINS]/imageformats INSTALLS += target
For more information, see Installing Files.
LEXIMPLS
Specifies a list of Lex implementation files. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
LEXOBJECTS
Specifies the names of intermediate Lex object files.The value of this variable is typically handled by qmake and rarely needs to be modified.
LEXSOURCES
Specifies a list of Lex source files. All dependencies, headers and source files will automatically be added to the project for building these lex files.
For example:
LEXSOURCES = lexer.l
LIBS
Specifies a list of libraries to be linked into the project. If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker). The library must exist for qmake to find the directory where a -l lib is located.
For example:
unix:LIBS += -L/usr/local/lib -lmath win32:LIBS += c:/mylibs/math.lib
To specify a path containing spaces, quote the path using the technique described in Whitespace.
win32:LIBS += "C:/mylibs/extra libs/extra.lib" unix:LIBS += "-L/home/user/extra libs" -lextra
By default, the list of libraries stored in LIBS is reduced to a list of unique names before it is used. To change this behavior, add the no_lflags_merge option to the CONFIG variable:
CONFIG += no_lflags_merge
LITERAL_HASH
This variable is used whenever a literal hash character (#) is needed in a variable declaration, perhaps as part of a file name or in a string passed to some external application.
For example:
# To include a literal hash character, use the $$LITERAL_HASH variable: urlPieces = http://qt-project.org/doc/qt-5.0/qtgui/qtextdocument.html pageCount message($$join(urlPieces, $$LITERAL_HASH))
By using LITERAL_HASH in this way, the # character can be used to construct a URL for the message() function to print to the console.
MAKEFILE
Specifies the name of the generated Makefile. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
MAKEFILE_GENERATOR
Specifies the name of the Makefile generator to use when generating a Makefile. The value of this variable is typically handled internally by qmake and rarely needs to be modified.
MOC_DIR
Specifies the directory where all intermediate moc files should be placed.
For example:
unix:MOC_DIR = ../myproject/tmp win32:MOC_DIR = c:/myproject/tmp
OBJECTS
This variable is automatically populated from the SOURCES variable. The extension of each source file is replaced by .o (Unix) or .obj (Win32). You can add objects to the list.
OBJECTS_DIR
Specifies the directory where all intermediate objects should be placed.
For example:
unix:OBJECTS_DIR = ../myproject/tmp win32:OBJECTS_DIR = c:/myproject/tmp
POST_TARGETDEPS
Lists the libraries that the target depends on. Some backends, such as the generators for Visual Studio and Xcode project files, do not support this variable. Generally, this variable is supported internally by these build tools, and it is useful for explicitly listing dependent static libraries.
This list is placed after all builtin (and $$PRE_TARGETDEPS) dependencies.
PRE_TARGETDEPS
Lists libraries that the target depends on. Some backends, such as the generators for Visual Studio and Xcode project files, do not support this variable. Generally, this variable is supported internally by these build tools, and it is useful for explicitly listing dependent static libraries.
This list is placed before all builtin dependencies.
PRECOMPILED_HEADER
Indicates the header file for creating a precompiled header file, to increase the compilation speed of a project. Precompiled headers are currently only supported on some platforms (Windows - all MSVC project types, Mac OS X - Xcode, Makefile, Unix - gcc 3.3 and up).
PWD
Specifies the full path leading to the directory containing the current file being parsed. This can be useful to refer to files within the source tree when writing project files to support shadow builds.
See also _PRO_FILE_PWD_.
Note: Do not attempt to overwrite the value of this variable.
OUT_PWD
Specifies the full path leading to the directory where qmake places the generated Makefile.
Note: Do not attempt to overwrite the value of this variable.
QMAKE
Specifies the name of the qmake program itself and is placed in generated Makefiles. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKESPEC
A system variable that contains the full path of the qmake configuration that is used when generating Makefiles. The value of this variable is automatically computed.
Note: Do not attempt to overwrite the value of this variable.
QMAKE_AR_CMD
Note: This variable is used on Unix platforms only.
Specifies the command to execute when creating a shared library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_BUNDLE_DATA
Note: This variable is used on Mac OS X only.
Specifies the data that will be installed with a library bundle, and is often used to specify a collection of header files.
For example, the following lines add path/to/header_one.h and path/to/header_two.h to a group containing information about the headers supplied with the framework:
FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.files = path/to/header_one.h path/to/header_two.h FRAMEWORK_HEADERS.path = Headers QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
The last line adds the information about the headers to the collection of resources that will be installed with the library bundle.
Library bundles are created when the lib_bundle option is added to the CONFIG variable.
See Platform Notes for more information about creating library bundles.
QMAKE_BUNDLE_EXTENSION
Note: This variable is used on Mac OS X only.
Specifies the extension to be used for library bundles. This allows frameworks to be created with custom extensions instead of the standard .framework directory name extension.
For example, the following definition will result in a framework with the .myframework extension:
QMAKE_BUNDLE_EXTENSION = .myframework
QMAKE_CC
Specifies the C compiler that will be used when building projects containing C source code. Only the file name of the compiler executable needs to be specified as long as it is on a path contained in the PATH variable when the Makefile is processed.
QMAKE_CFLAGS_DEBUG
Specifies the C compiler flags for debug builds. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CFLAGS_RELEASE
Specifies the C compiler flags for release builds. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CFLAGS_SHLIB
Note: This variable is used on Unix platforms only.
Specifies the compiler flags for creating a shared library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CFLAGS_THREAD
Specifies the compiler flags for creating a multi-threaded application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CFLAGS_WARN_OFF
This variable is used only when the warn_off CONFIG option is set. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CFLAGS_WARN_ON
This variable is used only when the warn_on CONFIG option is set. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CLEAN
Specifies a list of generated files (by moc and uic, for example) and object files to be removed by make clean.
QMAKE_CXX
Specifies the C++ compiler that will be used when building projects containing C++ source code. Only the file name of the compiler executable needs to be specified as long as it is on a path contained in the PATH variable when the Makefile is processed.
QMAKE_CXXFLAGS
Specifies the C++ compiler flags for building a project. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified. The flags specific to debug and release modes can be adjusted by modifying the QMAKE_CXXFLAGS_DEBUG and QMAKE_CXXFLAGS_RELEASE variables, respectively.
QMAKE_CXXFLAGS_DEBUG
Specifies the C++ compiler flags for debug builds. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CXXFLAGS_RELEASE
Specifies the C++ compiler flags for release builds. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CXXFLAGS_SHLIB
Specifies the C++ compiler flags for creating a shared library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CXXFLAGS_THREAD
Specifies the C++ compiler flags for creating a multi-threaded application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CXXFLAGS_WARN_OFF
Specifies the C++ compiler flags for suppressing compiler warnings. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_CXXFLAGS_WARN_ON
Specifies C++ compiler flags for generating compiler warnings. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_DISTCLEAN
Specifies a list of files to be removed by make distclean.
QMAKE_EXTENSION_SHLIB
Contains the extension for shared libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
Note: Platform-specific variables that change the extension override the contents of this variable.
QMAKE_EXT_MOC
Contains the extension used on included moc files.
See also File Extensions.
QMAKE_EXT_UI
Contains the extension used on Qt Designer UI files.
See also File Extensions.
QMAKE_EXT_PRL
Contains the extension used on created PRL files.
See also File Extensions, Library Dependencies.
QMAKE_EXT_LEX
Contains the extension used on files given to Lex.
See also File Extensions, LEXSOURCES.
QMAKE_EXT_YACC
Contains the extension used on files given to Yacc.
See also File Extensions, YACCSOURCES.
QMAKE_EXT_OBJ
Contains the extension used on generated object files.
See also File Extensions.
QMAKE_EXT_CPP
Contains suffixes for files that should be interpreted as C++ source code.
See also File Extensions.
QMAKE_EXT_H
Contains suffixes for files which should be interpreted as C header files.
See also File Extensions.
QMAKE_EXTRA_COMPILERS
Specifies a list of additional compilers or preprocessors.
See also Adding Compilers.
QMAKE_EXTRA_TARGETS
Specifies a list of additional qmake targets.
See also Adding Custom Targets.
QMAKE_FAILED_REQUIREMENTS
Contains the list of failed requirements. The value of this variable is set by qmake and cannot be modified.
See also requires() and REQUIRES.
QMAKE_FRAMEWORK_BUNDLE_NAME
Note: This variable is used on Mac OS X only.
In a framework project, this variable contains the name to be used for the framework that is built.
By default, this variable contains the same value as the TARGET variable.
See Creating Frameworks for more information about creating frameworks and library bundles.
QMAKE_FRAMEWORK_VERSION
Note: This variable is used on Mac OS X only.
For projects where the build target is a Mac OS X framework, this variable is used to specify the version number that will be applied to the framework that is built.
By default, this variable contains the same value as the VERSION variable.
See Creating Frameworks for more information about creating frameworks.
QMAKE_INCDIR
Specifies the list of system header paths that are appended to INCLUDEPATH. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_INCDIR_EGL
Specifies the location of EGL header files to be added to INCLUDEPATH when building a target with OpenGL/ES or OpenVG support. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_INCDIR_OPENGL
Specifies the location of OpenGL header files to be added to INCLUDEPATH when building a target with OpenGL support. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenGL implementation uses EGL (most OpenGL/ES systems), then QMAKE_INCDIR_EGL may also need to be set.
QMAKE_INCDIR_OPENGL_ES1, QMAKE_INCDIR_OPENGL_ES2
These variables specify the location of OpenGL headers files to be added to INCLUDEPATH when building a target with OpenGL ES 1 or OpenGL ES 2 support respectively.
The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenGL implementation uses EGL (most OpenGL/ES systems), then QMAKE_INCDIR_EGL may also need to be set.
QMAKE_INCDIR_OPENVG
Specifies the location of OpenVG header files to be added to INCLUDEPATH when building a target with OpenVG support. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenVG implementation uses EGL then QMAKE_INCDIR_EGL may also need to be set.
QMAKE_INCDIR_X11
Note: This variable is used on Unix platforms only.
Specifies the location of X11 header file paths to be added to INCLUDEPATH when building a X11 target. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_INFO_PLIST
Note: This variable is used on Mac OS X platforms only.
Specifies the name of the property list file, .plist, you would like to include in your Mac OS X application bundle.
In the .plist file, you can define some variables, e.g., @EXECUTABLE@, which qmake will replace with the actual executable name. Other variables include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@.
Note: Most of the time, the default Info.plist is good enough.
QMAKE_LFLAGS
Specifies a general set of flags that are passed to the linker. If you need to change the flags used for a particular platform or type of project, use one of the specialized variables for that purpose instead of this variable.
QMAKE_LFLAGS_CONSOLE
Note: This variable is used on Windows only.
Specifies the linker flags for building console programs. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_DEBUG
Specifies the linker flags for debug builds. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_PLUGIN
Specifies the linker flags for building plugins. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_RPATH
Note: This variable is used on Unix platforms only.
Specifies the linker flags needed to use the values from QMAKE_RPATHDIR.
The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_RPATHLINK
Specifies the linker flags needed to use the values from QMAKE_RPATHLINKDIR.
The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_RELEASE
Specifies the linker flags for release builds. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_APP
Specifies the linker flags for building applications. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_SHLIB
Specifies the linker flags used for building shared libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_SONAME
Specifies the linker flags for setting the name of shared objects, such as .so or .dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_THREAD
Specifies the linker flags for building multi-threaded projects. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LFLAGS_WINDOWS
Note: This variable is used on Windows only.
Specifies the linker flags for building Windows GUI projects (that is, non-console applications). The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBDIR
Specifies a list of system library paths. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBDIR_FLAGS
Note: This variable is used on Unix platforms only.
Specifies the location of all library directories with -L prefixed. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBDIR_EGL
Specifies the location of the EGL library directory, when EGL is used with OpenGL/ES or OpenVG. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBDIR_OPENGL
Specifies the location of the OpenGL library directory. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenGL implementation uses EGL (most OpenGL/ES systems), then QMAKE_LIBDIR_EGL may also need to be set.
QMAKE_LIBDIR_OPENVG
Specifies the location of the OpenVG library directory. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenVG implementation uses EGL, then QMAKE_LIBDIR_EGL may also need to be set.
QMAKE_LIBDIR_X11
Note: This variable is used on Unix platforms only.
Specifies the location of the X11 library directory. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBS
Specifies all project libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBS_EGL
Specifies all EGL libraries when building Qt with OpenGL/ES or OpenVG. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified. The usual value is -lEGL.
QMAKE_LIBS_OPENGL
Specifies all OpenGL libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenGL implementation uses EGL (most OpenGL/ES systems), then QMAKE_LIBS_EGL may also need to be set.
QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES2
These variables specify all the OpenGL libraries for OpenGL ES 1 and OpenGL ES 2.
The value of these variables is typically handled by qmake or qmake.conf and rarely needs to be modified.
If the OpenGL implementation uses EGL (most OpenGL/ES systems), then QMAKE_LIBS_EGL may also need to be set.
QMAKE_LIBS_OPENVG
Specifies all OpenVG libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified. The usual value is -lOpenVG.
Some OpenVG engines are implemented on top of OpenGL. This will be detected at configure time and QMAKE_LIBS_OPENGL will be implicitly added to QMAKE_LIBS_OPENVG wherever the OpenVG libraries are linked.
If the OpenVG implementation uses EGL, then QMAKE_LIBS_EGL may also need to be set.
QMAKE_LIBS_THREAD
Note: This variable is used on Unix platforms only.
Specifies all libraries that need to be linked against when building a multi-threaded target. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIBS_X11
Note: This variable is used on Unix platforms only.
Specifies all X11 libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LIB_FLAG
This variable is not empty if the lib template is specified. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LINK_SHLIB_CMD
Specifies the command to execute when creating a shared library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_LN_SHLIB
Specifies the command to execute when creating a link to a shared library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_POST_LINK
Specifies the command to execute after linking the TARGET together. This variable is normally empty and therefore nothing is executed.
Note: This variable takes no effect on Xcode projects.
QMAKE_PRE_LINK
Specifies the command to execute before linking the TARGET together. This variable is normally empty and therefore nothing is executed.
Note: This variable takes no effect on Xcode projects.
QMAKE_PROJECT_NAME
Note: This variable is used for Visual Studio project files only.
Determines the name of the project when generating project files for IDEs. The default value is the target name. The value of this variable is typically handled by qmake and rarely needs to be modified.
QMAKE_MAC_SDK
This variable is used on Mac OS X when building universal binaries.
QMAKE_MACOSX_DEPLOYMENT_TARGET
This variable only takes effect when building on Mac OS X. On that platform, the variable will be forwarded to the MACOSX_DEPLOYMENT_TARGET environment variable, which is interpreted by the compiler or linker. For more information, see the Deploying an Application on Mac OS X document.
QMAKE_MAKEFILE
Specifies the name of the Makefile to create. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_QMAKE
Contains the abosolute path of the qmake executable.
Note: Do not attempt to overwrite the value of this variable.
QMAKE_RESOURCE_FLAGS
This variable is used to customize the list of options passed to the Resource Compiler in each of the build rules where it is used. For example, the following line ensures that the -threshold and -compress options are used with particular values each time that rcc is invoked:
QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
QMAKE_RPATHDIR
Note: This variable is used on Unix platforms only.
Specifies a list of library paths that are added to the executable at link time so that the paths will be preferentially searched at runtime.
QMAKE_RPATHLINKDIR
Specifies a list of library paths for the static linker to search for implicit dependencies of shared libraries. For more information, see the manual page for ld(1).
QMAKE_RUN_CC
Specifies the individual rule needed to build an object. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_RUN_CC_IMP
Specifies the individual rule needed to build an object. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_RUN_CXX
Specifies the individual rule needed to build an object. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_RUN_CXX_IMP
Specifies the individual rule needed to build an object. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QMAKE_TARGET
Specifies the name of the project target. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
QT
Specifies the Qt modules that are used by your project.
The table below shows the options that can be used with the QT variable and the Qt modules that are associated with each of them:
Option | Module Enabled |
---|---|
axcontainer | QAxContainer, which is part of the Active Qt framework |
axserver | QAxServer, which is part of the Active Qt framework |
concurrent | Qt Concurrent |
core (included by default) | Qt Core |
dbus | Qt D-Bus |
declarative | Qt Quick 1 (deprecated) |
designer | Qt Designer |
designercomponents | Qt Designer Components |
gui (included by default) | Qt GUI |
help | Qt Help |
multimedia | Qt Multimedia |
multimediawidgets | Qt Multimedia Widgets |
network | Qt Network |
opengl | Qt OpenGL (deprecated) |
printsupport | Qt Print Support |
qml | Qt QML |
qmltest | Qt QML Test |
x11extras | Qt X11 Extras |
quick | Qt Quick |
script | Qt Script (deprecated) |
scripttools | Qt Script Tools (deprecated) |
sensors | Qt Sensors |
serialport | Qt Serial Port |
sql | Qt SQL |
svg | Qt SVG |
testlib | Qt Test |
uitools | Qt UI Tools |
webkit | Qt WebKit |
webkitwidgets | Qt WebKit Widgets |
widgets | Qt Widgets |
xml | Qt XML (deprecated) |
xmlpatterns | Qt XML Patterns |
By default, QT contains both core and gui, ensuring that standard GUI applications can be built without further configuration.
If you want to build a project without the Qt GUI module, you need to exclude the gui value with the "-=" operator. The following line will result in a minimal Qt project being built:
QT -= gui # Only the core module is used.
QTPLUGIN
Specifies a list of names of static Qt plugins that are to be linked with an application so that they are available as built-in resources.
QT_VERSION
Contains the current version of Qt.
QT_MAJOR_VERSION
Contains the current major version of Qt.
QT_MINOR_VERSION
Contains the current minor version of Qt.
QT_PATCH_VERSION
Contains the current patch version of Qt.
RC_FILE
Specifies the name of the resource file for the application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
RC_INCLUDEPATH
Specifies include paths that are passed to the Windows Resource Compiler.
RCC_DIR
Specifies the directory for Qt Resource Compiler output files.
For example:
unix:RCC_DIR = ../myproject/resources win32:RCC_DIR = c:/myproject/resources
REQUIRES
Specifies a list of values that are evaluated as conditions. If any of the conditions is false, qmake skips this project (and its SUBDIRS) when building.
Note: We recommend using the requires() function instead if you want to skip projects or subprojects when building.
RESOURCES
Specifies the name of the resource collection files (qrc) for the target. For more information about the resource collection file, see The Qt Resource System.
RES_FILE
Specifies the name of the compiled Windows resource file for the target. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
SIGNATURE_FILE
Note: This variable is only used on Windows CE.
Specifies which signature file should be used to sign the project target.
Note: This variable will overwrite the setting you have specified in configure, with the -signature option.
SOURCES
Specifies the names of all source files in the project.
For example:
SOURCES = myclass.cpp \ login.cpp \ mainwindow.cpp
See also HEADERS.
SUBDIRS
This variable, when used with the subdirs template Specifies the names of all subdirectories or project files that contain parts of the project that need be built. Each subdirectory specified using this variable must contain its own project file.
For example:
SUBDIRS = kernel \ tools
It is essential that the project file in each subdirectory has the same name as the subdirectory itself, so that qmake can find it. For example, if the subdirectory is called myapp then the project file in that directory should be called myapp.pro.
If you need to ensure that the subdirectories are built in the order in which they are specified, update the CONFIG variable to include the ordered option:
CONFIG += ordered
It is possible to modify this default behavior of SUBDIRS by giving additional modifiers to SUBDIRS elements. Supported modifiers are:
Modifier | Effect |
---|---|
.subdir | Use the specified subdirectory instead of SUBDIRS value. |
.file | Specify the subproject pro file explicitly. Cannot be used in conjunction with .subdir modifier. |
.depends | This subproject depends on specified subproject. Available only on platforms that use makefiles. |
.makefile | The makefile of subproject. Available only on platforms that use makefiles. |
.target | Base string used for makefile targets related to this subproject. Available only on platforms that use makefiles. |
For example, define two subdirectories, both of which reside in a different directory than the SUBDIRS value, and one of the subdirectories must be built before the other:
SUBDIRS += my_executable my_library my_executable.subdir = app my_executable.depends = my_library my_library.subdir = lib
TARGET
Specifies the name of the target file. Contains the base name of the project file by default.
For example:
TEMPLATE = app TARGET = myapp SOURCES = main.cpp
The project file above would produce an executable named myapp on unix and myapp.exe on Windows.
TARGET_EXT
Specifies the extension of TARGET. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
TARGET_x
Specifies the extension of TARGET with a major version number. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
TARGET_x.y.z
Specifies the extension of TARGET with version number. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
TEMPLATE
Specifies the name of the template to use when generating the project. The allowed values are:
Option | Description |
---|---|
app | Creates a Makefile for building applications (the default). See Building an Application for more information. |
lib | Creates a Makefile for building libraries. See Building a Library for more information. |
subdirs | Creates a Makefile for building targets in subdirectories. The subdirectories are specified using the SUBDIRS variable. |
vcapp | Windows only. Creates an application project for Visual Studio. See Creating Visual Studio Project Files for more information. |
vclib | Windows only. Creates a library project for Visual Studio. |
For example:
TEMPLATE = lib SOURCES = main.cpp TARGET = mylib
The template can be overridden by specifying a new template type with the -t command line option. This overrides the template type after the .pro file has been processed. With .pro files that use the template type to determine how the project is built, it is necessary to declare TEMPLATE on the command line rather than use the -t option.
TRANSLATIONS
Specifies a list of translation (.ts) files that contain translations of the user interface text into non-native languages.
See the Qt Linguist Manual for more information about internationalization (i18n) and localization (l10n) with Qt.
UI_DIR
Specifies the directory where all intermediate files from uic should be placed.
For example:
unix:UI_DIR = ../myproject/ui win32:UI_DIR = c:/myproject/ui
VERSION
Specifies the version number of the application if the app template is specified or the version number of the library if the lib template is specified.
For example:
VERSION = 1.2.3
VER_MAJ
Specifies the major version number of the library if the lib template is specified.
VER_MIN
Specifies the minor version number of the library if the lib template is specified.
VER_PAT
Specifies the patch version number of the library if the lib template is specified.
VPATH
Tells qmake where to search for files it cannot open. For example, if qmake looks for SOURCES and finds an entry that it cannot open, it looks through the entire VPATH list to see if it can find the file on its own.
See also DEPENDPATH.
YACCSOURCES
Specifies a list of Yacc source files to be included in the project. All dependencies, headers and source files will automatically be included in the project.
For example:
YACCSOURCES = moc.y
_PRO_FILE_
Contains the path to the project file in use.
For example, the following line causes the location of the project file to be written to the console:
message($$_PRO_FILE_)
Note: Do not attempt to overwrite the value of this variable.
_PRO_FILE_PWD_
Contains the path to the directory containing the project file in use.
For example, the following line causes the location of the directory containing the project file to be written to the console:
message($$_PRO_FILE_PWD_)
Note: Do not attempt to overwrite the value of this variable.