Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
[Prev: Using Precompiled Headers] [Home]
This reference is a detailed index of all command line options, configurations and internal variables used by the cross-platform makefile generation utility qmake.
In addition to the variables and functions described in the following sections, qmake project files may also include comments. Comments begin with the '#' symbol and run to the end of the line.
qmake [options] files
The following options can be specified on the command line to qmake:
-o file
qmake output will be directed to file. if this argument is not specified, then qmake will try to guess a suitable name. If '-' is specified, output is directed to stdout.
-unix
qmake will run in unix mode. In this mode, Unix file naming and path conventions will be used, additionally testing for unix (as a scope) will succeed. This is the default mode on all Unices.
-macx
qmake will run in Mac OS X mode. In this mode, Unix file naming and path conventions will be used, additionally testing for macx (as a scope) will succeed. This is the default mode on Mac OS X.
-win32
qmake will run in win32 mode. In this mode, Windows file naming and path conventions will be used, additionally testing for win32 (as a scope) will succeed. This is the default mode on Windows.
-d
qmake will output (hopefully) useful debugging information.
-t tmpl
qmake will override any set TEMPLATE variables with tmpl, but only after the .pro file has been processed.
-tp prefix
qmake will add the prefix to the TEMPLATE variable.
-help
qmake will go over these features and give some useful help.
There are also warning options that can help to find problems in your project file:
-Wall
With this qmake will turn on all known warnings.
-Wnone
No warning information will be generated by qmake.
-Wparser
qmake will only generate parser warnings, this will alert you to common pitfalls, and potential problems in the parsing of your .pro files.
-Wlogic
Again qmake will warn of common pitfalls, and potential problems. This can include (but not limited to) checking if a file is placed into a list of files multiple times, if a file cannot be found, etc.
qmake supports two different modes of operation. The first mode, which is the default is makefile generation. In this mode, qmake will take a .pro file and turn it into a makefile. Creating makefiles is covered by this reference guide, there is another mode which generates .pro files.
To toggle between these modes you must specify in the first argument what mode you want to use. If no mode is specified, qmake will assume you want makefile mode. The available modes are:
-makefile
qmake output will be a makefile (Makefile mode).
-project
qmake output will be a project file (Project file mode).
In Makefile mode qmake will generate a makefile. Additionally you may supply the following arguments in this mode:
-after
qmake will process assignments given on the commandline after the specified files.
-nocache
qmake will ignore the .qmake.cache file.
-nodepend
qmake will not generate any dependency information.
-cache file
qmake will use file as the cache file, ignoring any other .qmake.cache file found
-spec spec
qmake will use spec as a path to platform-compiler information and QMAKESPEC will be ignored.
The files argument can be a list of one or more project files, separated by spaces. You may also pass qmake assignments on the command line here and they will be processed before all files specified, for example:
qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro
If however you are certain you want your variables processed after the the files specified, then you may pass the -after argument. When this is specified all assignments on the commandline after the -after option will be postponed until after the specified files are parsed.
This will generate a Makefile, from test.pro with Unix pathnames. However many of these arguments aren't necessary as they are the default. Therefore the line can be simplified on Unix to:
qmake "CONFIG+=test" test.pro
In Projectfile mode qmake will generate a project file. Additionally, you may supply the following arguments in this mode:
-r
qmake will look through supplied directories recursively
-nopwd
qmake will not look in your current working directory for source code and only use the specified files
The files argument can be a list of files or directories. If a directory is specified, then it will be included in the DEPENDPATH variable and relevant code from there will be included in the generated project file, if a file is given it will go into the correct variable depending on extension (i.e. .ui files go into FORMS, .cpp files go into SOURCES, etc). Here too you may pass assignments on the commandline, when doing so these assignments will be placed last in the generated .pro file.
The following variables are recognized by qmake and are used most frequently when creating project files.
The CONFIG variable specifies project configuration and compiler options. The values will be recognized internally by qmake and have special meaning. They are as follows.
These CONFIG values control compilation flags:
release - Compile with optimization enabled, ignored if "debug" is specified
debug - Compile with debug options enabled
warn_on - The compiler should emit more warnings than normally, ignored if "warn_off" is specified
warn_off - The compiler should only emit severe warnings.
These options define the application/library type:
qt - The target is a TQt application/library and requires the TQt header files/library. The proper include and library paths for the TQt library will automatically be added to the project.
opengl - The target requires the OpenGL (or Mesa) headers/libraries. The proper include and library paths for these libraries will automatically be added to the project.
thread - The target is a multi-threaded application or library. The proper defines and compiler flags will automatically be added to the project.
x11 - The target is a X11 application or library. The proper include paths and libraries will automatically be added to the project.
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.
dll - The target is a shared object/DLL.The proper include paths, compiler flags and libraries will automatically be added to the project.
staticlib - The target is a static library (lib only). The proper compiler flags will automatically be added to the project.
plugin - The target is a plugin (lib only). This enables dll as well.
These options are used to set the compiler flags:
exceptions - Exception support is enabled
rtti - RTTI support is enabled
stl - STL support is enabled
These options define specific things depending on the platform and/or template:
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.
The CONFIG variable will also be checked when resolving scopes. You may assign anything to this variable.
For example:
CONFIG += qt console newstuff ... newstuff { SOURCES += new.cpp HEADERS += new.h }
qmake adds the values of this variable as compiler C preprocessor macros (-D option).
For example:
DEFINES += USE_MY_STUFF QT_DLL
This is only used on Windows when using the 'app' template.
Specifies a .def file to be included in the project.
Specifies where to put the target file.
For example:
DESTDIR = ../../lib
Specifies where to copy the target dll.
Defines the header files for the project.
qmake will generate dependency information (unless -nodepend is specified on the command line) for the specified headers. qmake will also automatically detect if tqmoc is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the tqmoc files.
For example:
HEADERS = myclass.h \ login.h \ mainwindow.h
See also SOURCES.
This variable specifies the #include directories which should be searched when compiling the project. Use ';' or a space as the directory separator.
For example:
INCLUDEPATH = c:\msdev\include d:\stl\include
This variable specifies the .ui files (see TQt Designer) to be processed through tquic 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
Note that forms should not be specified using the += operator because this syntax is not fully supported by TQt Designer.
This variable contains 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
This variable contains a list of libraries to be linked into the project. If you are more comfortable with the Unix convension of -L/-l flags you are free to use them in a cross-platform manner and qmake will do the correct thing with these libraries on Windows (namely this means passing the full path of the library to the linker). The only limitation to this is the library must exist, for qmake to find which directory a -l lib lives in.
For example:
unix:LIBS += -lmath -L/usr/local/lib win32:LIBS += c:\mylibs\math.lib
This variable specifies the directory where all intermediate tqmoc files should be placed.
For example:
unix:MOC_DIR = ../myproject/tmp win32:MOC_DIR = c:\myproject\tmp
This variable specifies the directory where all intermediate objects should be placed.
For example:
unix:OBJECTS_DIR = ../myproject/tmp win32:OBJECTS__DIR = c:\myproject\tmp
This variable specifies the directory where all intermediate files from tquic should be placed. This variable overrides both UI_SOURCES_DIR and UI_HEADERS_DIR.
For example:
unix:UI_DIR = ../myproject/ui win32:UI_DIR = c:\myproject\ui
This variable specifies the directory where all declaration files (as generated by tquic) should be placed.
For example:
unix:UI_HEADERS_DIR = ../myproject/ui/include win32:UI_HEADERS_DIR = c:\myproject\ui\include
This variable specifies the directory where all implementation files (as generated by tquic) should be placed.
For example:
unix:UI_SOURCES_DIR = ../myproject/ui/src win32:UI_SOURCES_DIR = c:\myproject\ui\src
This is a special variable processed by qmake. If the contents of this variable do not appear in CONFIG by the time this variable is assigned, then a minimal makefile will be generated that states what dependencies (the values assigned to REQUIRES) are missing.
This is mainly used in TQt's build system for building the examples.
This variable contains the name of all source files in the project.
For example:
SOURCES = myclass.cpp \ login.cpp \ mainwindow.cpp
See also HEADERS
This variable, when used with the 'subdirs' TEMPLATE contains the names of all subdirectories to look for a project file.
For example:
SUBDIRS = kernel \ tools
This specifies the name of the target file.
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.
This variable contains the name of the template to use when generating the project. The allowed values are:
app - Creates a makefile for building applications (the default)
lib - Creates a makefile for building libraries
subdirs - Creates a makefile for building targets in subdirectories
vcapp - win32 only Creates an application project file for Visual Studio
vclib - win32 only Creates a library project file 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.
This variable contains the version number of the library if the 'lib' TEMPLATE is specified.
For example:
VERSION = 1.2.3
This variable contains a list of files to be included in the dist target. This feature is supported by UnixMake specs only.
For example:
DISTFILES += ../program.txt
This variable contains 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 = tqmoc.y
The following variables are also recognized by qmake but are either internal or very rarely used.
This variable is set internally by qmake, which is basically the DESTDIR variable with the TARGET variable appened at the end. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable is set internally by qmake, which specifies where the dsp template file for basing generated dsp files is stored. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains 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.
This variable contains the names of intermediate lex object files.The value of this variable is typically handled by qmake and rarely needs to be modified.
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://doc.trolltech.com/3.3/qmake-manual-8.html LITERAL_HASH 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.
This variable specifies the name of the makefile which qmake should use when outputting the dependency information for building a project. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains 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.
This variable is generated from the SOURCES variable. The extension of each source file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable is set by qmake if files can be found that contain the TQ_OBJECT macro. OBJMOC contains the name of all intermediate tqmoc object files. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable 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).
On other platforms, this variable has different meaning, as noted below.
This variable contains a list of header files that require some sort of pre-compilation step (such as with tqmoc). The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains 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.
This variable contains the name of the qmake configuration to use when generating makefiles. The value of this variable is typically handled by qmake and rarely needs to be modified. Use the QMAKESPEC environment variable instead.
This variable is empty unless the 'app' TEMPLATE is specified. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified. Use the following instead:
app { #conditional code for 'app' template here }
This variable is empty unless the 'app' or 'dll' TEMPLATE is specified. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains the command for invoking the program which creates, modifies and extracts archives. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the flags for the C compiler in debug mode.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the compiler flags for creating a multi-threaded application or when the version of TQt that you link against is a multi-threaded statically linked library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the compiler flags for creating a debuggable multi-threaded application or when the version of TQt that you link against is a debuggable multi-threaded statically linked library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains the compiler flags for creating a multi-threaded dll or when the version of TQt that you link against is a multi-threaded dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains the compiler flags for creating a debuggable multi-threaded dll or when the version of TQt that you link against is a debuggable multi-threaded statically linked library. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the compiler flags for creating a non-debuggable application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains 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.
This variable contains 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.
This variable is not empty if the warn_off TEMPLATE option is specified. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable is not empty if the warn_on TEMPLATE option is specified. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains any files which are not generated files (such as tqmoc and tquic generated files) and object files that should be removed when using "make clean".
This variable contains the C++ compiler flags for creating a debuggable application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains 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.
This variable contains the C++ compiler flags for creating a debuggable multi-threaded application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains the C++ compiler flags for creating a multi-threaded dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains the C++ compiler flags for creating a multi-threaded debuggable dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the C++ compiler flags for creating an application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains 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.
This variable contains 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.
This variable contains 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.
This variable contains 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.
This variable contains the extention for shared libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the list of requirements that were failed to be met when qmake was used. For example, the sql module is needed and wasn't compiled into TQt. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the file tags needed to be entered into the makefile, such as SOURCES and HEADERS. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the location of all known header files to be added to INCLUDEPATH when building an application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
All libraries that the target depends on can be listed in this variable. Some backends do not support this, these include MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is support internally by these build tools, this is usefull for explicitly listing dependant static libraries.
This list will go after all builtin (and $$PRE_TARGETDEPS) dependencies.
All libraries that the target depends on can be listed in this variable. Some backends do not support this, these include MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is support internally by these build tools, this is usefull for explicitly listing dependant static libraries.
This list will go before all builtin dependencies.
This variable contains the location of OpenGL header files to be added to INCLUDEPATH when building an application with OpenGL support. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the location of all known header file paths to be added to INCLUDEPATH when building a TQt application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the location of all known header file paths to be added to INCLUDEPATH when building a multi-threaded application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains the location of X11 header file paths to be added to INCLUDEPATH when building a X11 application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains link flags when building console programs. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains link flags when building console dlls. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains link flags when building debuggable applications. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains link flags when building plugins. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains link flags when building programs that use the TQt library built as a dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains link flags when building applications for release. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains link flags when building applications which are using the 'app' template. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains link flags when building shared libraries The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable specifies the link flags to set 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.
This variable contains link flags when building multi-threaded projects. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains link flags when building windows projects. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains link flags when building windows dll projects. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the location of all known library directories.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains the location of all library directory with -L prefixed. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable tells qmake where to search for files it cannot open. With this you may tell qmake where it may look for things like SOURCES, and if it finds an entry in SOURCES that cannot be opened it will look through the entire VPATH list to see if it can find the file on its own.
See also DEPENDPATH.
This variable contains the list of all directories to look in to resolve dependencies. This will be used when crawling through 'included' files.
This variable contains 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.
This variable contains the location of the TQt library directory.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains 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.
This variable contains all project libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains all project libraries that should be linked against when building a console application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains all OpenGL libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains all OpenGL TQt libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains all TQt libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains all TQt libraries when TQt is built as a dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains all the libraries needed to link against if OpenGL support is turned on. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains all the libraries needed to link against if thread support is turned on. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used with Borland compilers only
This variable contains the runtime library needed to link against when building an application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used with Borland compilers only
This variable contains the runtime library needed to link against when building a multi-threaded application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains all libraries that need to be linked against when building a multi-threaded application. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Windows only
This variable contains all windows libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains all X11 libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This is used on Unix platforms only
This variable contains all X11 session management libraries. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
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.
This variable contains 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.
This variable contains the command to execute after linking the TARGET together. This variable is normally empty and therefore nothing is executed, additionally some backends will not support this - mostly only Makefile backends.
This variable contains the command to execute before linking the TARGET together. This variable is normally empty and therefore nothing is executed, additionally some backends will not support this - mostly only Makefile backends.
This variable contains 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.
This variable contains 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.
This variable contains the names of all tqmoc source files to generate and include in the project. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the location of qmake if it is not in the path. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable is not empty if TQt was built as a dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable 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.
This variable 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.
This variable 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.
This variable 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.
This variable contains 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.
This variable contains the location of tquic if it is not in the path. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
It can be used to specify arguments to tquic as well, such as additional plugin paths. For example:
QMAKE_UIC = tquic -L /path/to/plugin
This variable contains 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.
This variable contains 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.
This variable is set by qmake if files can be found that contain the TQ_OBJECT macro. SRCMOC contains the name of all the generated tqmoc files. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable specifies the target's extension. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable specifies the target's extension with a major version number. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable specifies the target's extension with version number. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains a list of the generated implementation files by TQUIC. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable is generated from the UICIMPLS variable. The extension of each file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains the major version number of the library, if the 'lib' template is specified.
This variable contains the minor version number of the library, if the 'lib' template is specified.
This variable contains the patch version number of the library, if the 'lib' template is specified.
This variable changes the extention used on included tqmoc files.
See also File Extensions.
This variable changes the extention used on /e Designer UI files.
See also File Extensions.
This variable changes the extention used on created PRL files.
See also File Extensions, Library Dependencies.
This variable changes the extention used on files given to lex.
See also File Extensions, LEXSOURCES.
See also File Extensions, YACCSOURCES.
This variable changes the extention used on generated object files.
See also File Extensions.
This variable changes the interpretation of all suffixes in this list of values as files of type C++ source code.
See also File Extensions.
This variable changes the interpretation of all suffixes in this list of values as files of type C header files.
See also File Extensions.
This variable contains a list of yacc source files. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
This variable contains a list of yacc object files. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
qmake recognizes the following functions:
This function will include the contents of filename into the current project at the point where was included. The function succeeds if filename was included, otherwise it fails. You can check the return value of this function using a scope.
For example:
include( shared.pri ) OPTIONS = standard custom !include( options.pri ) { message( "No custom build options specified" ) OPTIONS -= custom }
This function will test if file exists. If the file exists, then it will succeed; otherwise it will fail. You can specify a regular expression in file and it will succeed if any file matches the regular expression specified.
For example:
exists( $(TQTDIR)/lib/libtqt-mt* ) { message( "Configuring for multi-threaded TQt..." ) CONFIG += thread }
This function will succeed if the variable variablename contains the value value. You can check the return value of this function using a scope.
For example:
contains( drivers, network ) { # drivers contains 'network' message( "Configuring for network build..." ) HEADERS += network.h SOURCES += network.cpp }
This function will succeed if the variable variablename contains number elements, otherwise it will fail. You can check the return value of this function using a scope.
For example:
MYVAR = one two three count( MYVAR, 3 ) { # always true }
This function will succeed if the file filename (when parsed by qmake itself) contains the variable var with a value of val. You may also not pass in a third argument (val) and the function will only test if var has been assigned to in the file.
This function will succeed if the variable variablename is empty (same as count(variable, 0)).
This function will execute command in a secondary shell and will succeed if the command exits with an exit status of 1. You can check the return value of this function using a scope.
For example:
system(ls /bin):HAS_BIN=FALSE
This function will always succeed, and will display the given string to the user.
This function will never return a value. It will display the given string to the user, and then exit qmake. This function should only be used for very fatal configurations.
For example:
release:debug:error(You can't have release and debug at the same time!)
qmake has a system of persistant information, this allows you to 'set' a variable in qmake once, and each time qmake is invoked this value can be queried. Use the following to set a property in qmake:
qmake -set VARIABLE VALUE
To retrieve this information back from qmake you can do:
qmake -query VARIABLE qmake -query #queries all current VARIABLE/VALUE pairs..
This information will be saved into a TQSettings object (meaning it will be stored in different places for different platforms). As VARIABLE is versioned as well, you can set one value in an older version of qmake, and newer versions will retrieve this value, however if you -set VARIABLE into a newer version of qmake the older version will not use this value. You can however query a specific version of a variable if you prefix that version of qmake to VARIABLE, as in:
qmake -query "1.06a/VARIABLE"
qmake also has the notion of 'builtin' properties, for example you can query the installation of TQt for this version of qmake with the QT_INSTALL_PREFIX property:
qmake -query "QT_INSTALL_PREFIX"
These builtin properties cannot have a version prefixed to them as they are not versioned and each qmake will have its own notion of these values. The list below outlines the builtin properties:
QT_INSTALL_PREFIX - Where the version of TQt this qmake is built for resides
QT_INSTALL_DATA - Where data for this version of TQt resides
QMAKE_VERSION - The current version of qmake
Finally, these values can be queried in a project file with a special notation such as:
QMAKE_VERS = $$[QMAKE_VERSION]
qmake requires a platform and compiler description file which contains many default values used to generate appropriate makefiles. The standard TQt distribution comes with many of these files, located in the 'mkspecs' subdirectory of the TQt installation.
The QMAKESPEC environment variable can contain any of the following:
A complete path to a directory containing a qmake.conf file. In this case qmake will open the qmake.conf file from within that directory. If the file does not exist, qmake will exit with an error.
The name of a platform-compiler combination. In this case, qmake will search in the directory specified by the TQTDIR environment variable.
Note: the QMAKESPEC path will automatically be added to the INCLUDEPATH system variable.
It is common on UNIX to be able to install from the same utility as you build with (e.g make install). For this qmake has introduce the concept of an install set. The notation for this is quite simple, first you fill in an "object" in qmake for example:
documentation.path = /usr/local/program/doc documentation.files = docs/*
In this way you are telling qmake several things about this install, first that you plan to install to /usr/local/program/doc (the path member), second that you plan to copy everything in the docs directory. Once this is done you may insert it in the install list:
INSTALLS += documentation
Now qmake will take over making sure the correct things are copied to the specified places. If however you require greater control you may use the 'extra' member of the object:
unix:documentation.extra = create_docs; mv master.doc toc.doc
Then qmake will run the things in extra (this is of course platform specific, so you may need to test for your platform first, this case we test for unix). Then it will do the normal processings of the files member. Finally if you appened a builtin install to INSTALLS qmake (and do not specify a files or extra member) will decide what needs to be copied for you, currently the only supported builtin is target:
target.path = /usr/local/myprogram INSTALLS += target
With this qmake will know what you plan need copied, and do this for you.
The cache file (mentioned above in the options) is a special file qmake will read to find settings not specified in the qmake.conf file, the .pro file, or the command line. If -nocache is not specified, qmake will try to find a file called .qmake.cache in parent directories. If it fails to find this file, it will silently ignore this step of processing.
Often when linking against a library qmake relies on the underlying platform to know what other libraries this library links against, and lets the platform pull them in. In many cases, however, this is not sufficent. For example when statically linking a library there are no libraries linked against, and therefore no dependencies to those libraries are created - however an application that later links against this library will need to know where to find the symbols that the linked in library will require. To help with this situation qmake will follow a library's dependencies when it feels appropriate, however this behaviour must be enabled in qmake. To enable requires two steps. First, you must enable it in the library - to do this you must tell qmake to save information about this library:
CONFIG += create_prl
This is only relevant to the lib template, and will be ignored for all others. When this option is enabled qmake will create a file (called a .prl file) which will save some meta information about the library. This metafile is itself just a qmake project file, but with all internal variables. You are free to view this file, and if deleted qmake will know to recreate it when necesary (either when the .pro file is later read, or if a dependent library (described below) has changed). When installing this library (by using target in INSTALLS, above) qmake will automatically copy the .prl file to your install path.
The second step to enabling this processing is to turn on reading of the meta information created above:
CONFIG += link_prl
When this is turned on qmake will process all libraries linked to, and find their meta information. With this meta information qmake will figure out what is relevant to linking, specifically it will add to your list of DEFINES as well as LIBS. Once qmake has processed this file, it will then look through the newly introduced LIBS and find their dependent .prl files, and continue until all libraries have been resolved. At this point the makefile is created as usual, and the libraries are linked explicity against your program.
The internals of the .prl file are left closed so they can easily change later. It is not designed to be changed by hand however, and should only be created by qmake - these .prl files should also not be transfered from operating system to operating system as they may be platform dependent (like a makefile).
Under normal circumstances qmake will try to use appropriate file extensions for your platform. There may be times, however, that you would like to override the behavior of these extensions. To do this, you must modify builtin variables in your .pro file, which will in turn changes qmake's interpretation of these files. You may do this as:
QMAKE_EXT_MOC = .mymoc
The variables are as follows:
QMAKE_EXT_MOC - This modifies the extension placed on included moc files.
QMAKE_EXT_UI - This modifies the extension used for designer UI files (usually in FORMS).
QMAKE_EXT_PRL - This modifies the extension placed on library dependency files.
QMAKE_EXT_LEX - This changes the suffix used in files (usually in LEXSOURCES).
QMAKE_EXT_YACC - This changes the suffix used in files (usually in YACCSOURCES).
QMAKE_EXT_OBJ - This changes the suffix used on generated object files.
All the above accept just the first value, so you must assign to it one value that will be used through your makefile. There are two variables that accept a list of values, they are:
QMAKE_EXT_CPP - Changes interpretation all files with these suffixes to be C++ source files.
QMAKE_EXT_H - Changes interpretation all files with these suffixes to be C header files.
qmake often tries to be all things to all build tools, this is often less than ideal when you really need to run special platform dependent commands. This can be achieved with specific instructions to the different qmake backends (currently this is only supported by the UNIX generator).
The interfaces to customizing the Makefile are done through "objects" as in other places in qmake. The notation for this is quite simple, first you fill in an "object" in qmake for example:
mytarget.target = .buildfile mytarget.commands = touch $$mytarget.target mytarget.depends = mytarget2 mytarget2.commands = @echo Building $$mytarget.target
The information above defines a qmake target called mytarget which contains a Makefile target called .buildfile, .buildfile is generated by 'touch .buildfile', and finally that this Makefile target depends on the qmake target mytarget2. Additionally we've defined the qmake target mytarget2 which simply echo's something to stdout.
The final step to making use of the above is to instruct qmake that this is actually an object used by the target building parts of qmake by:
QMAKE_EXTRA_UNIX_TARGETS += mytarget mytarget2
This is all you need to do to actually build custom targets in qmake, of course you may want to tie one of these targets to actually building the qmake build target. To do this, you simply need to include your Makefile target in the list of PRE_TARGETDEPS.
For convenience there is also a method of customizing (UNIX) projects for generic new compilers (or even preprocessors).
new_moc.output = tqmoc_${QMAKE_FILE_BASE}.cpp new_moc.commands = tqmoc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} new_moc.depends = g++ -E -M ${QMAKE_FILE_NAME} | sed "s,^.*: ,," new_moc.input = NEW_HEADERS QMAKE_EXTRA_UNIX_COMPILERS += new_moc
With this you can create a new moc for qmake, the commands will be executed over all arguments given to a NEW_HEADERS variable (from the input variable), and write to output (and automatically hand this filename to the compiler to be linked into your target). Additionally qmake will execute depends to generate dependency information and place this in the project as well.
These commands can easily be placed into a cache file, and subsequent .pro files can give several arguments to NEW_HEADERS.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|