![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
This reference is a detailed index of all commandline options, configurations and internal variables used by the qmake cross-platform makefile generation utility.
For a higher level introduction to using qmake see the qmake User's Guide.
qmake [options] files
The following options can be specified on the command line to qmake:
QMake supports two different modes of operation. The first mode (and default) is makefile generation, in this mode qmake will take a .pro file and turn it into a proper system Makefile. This is the mode documented in this guide, however there is an additional mode in qmake to generate .pro files from source code.
To toggle between these modes you must specify in the first argument what mode you want, if no mode is specified qmake will assume you want makefile mode, the available mode switches are:
In Makefile mode QMake will generate a makefile. Additionally you may supply the following arguments in this mode:
The files argument can be a list of one or more project files, separated by spaces. You may also pass qmake assignments on the commandline here and they will be processed before all files specified, for example:
qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro
This will generate a Makefile from test.pro, with Unix pathnames, however many of these arguments aren't necesary as they are the default:
qmake "CONFIG+=test" test.pro
In Projectfile mode QMake will generate a project file. Additionally you may supply the following arguments in this mode:
The files argument can be a list of files or directories, if a directory is specified this will be included in the DEPENDPATH 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 extention (ie .ui files go into INTERFACES, .cpp files go into SOURCES, etc).
For a higher level introduction to qmake variables and how they are used, see the qmake User's Guide.
The following variables are recognized by qmake and are used most frequently when creating project files.
These CONFIG values control compilation flags:
These options define the application/library type:
The CONFIG variable will also be checked when resolving scope. You may assign anything to this variable.
For example:
CONFIG += qt console newstuff ... newstuff { SOURCES += new.cpp HEADERS += new.h }
For example:
DEFINES += USE_MY_STUFF QT_DLL
Specifies a .def file to be included in the project.
For example:
DESTDIR = ../../lib
Also see this note.
Also see this note.
qmake will generate dependancy information (unless -nodepend is specified on the command line) for the specified headers. qmake will also automatically detect if moc is required by the classes in these headers, and add the appropriate dependancies and files to the project for generating and linking the moc files.
For example:
HEADERS = myclass.h \ login.h \ mainwindow.h
See also SOURCES
.
For example:
INCLUDEPATH = c:\msdev\include d:\stl\include
For example:
INTERFACES = mydialog.ui \ mywidget.ui \ myconfig.ui
For example:
LEXSOURCES = lexer.l
For example:
unix:LIBS += -lmath -L/usr/local/lib win32:LIBS += c:\mylibs\math.lib
For example:
unix:MOC_DIR = ../myproject/tmp win32:MOC_DIR = c:\myproject\tmp
Also see this note.
For example:
unix:OBJECTS_DIR = ../myproject/tmp win32:OBJECTS__DIR = c:\myproject\tmp
Also see this note.
Q_OBJECT
. OBJMOC
contains the
name of all intermediate moc object files. The value of this variable
is typically handled by qmake or qmake.conf and rarely needs to be
modified.
For example:
SOURCES = myclass.cpp \ login.cpp \ mainwindow.cpp
See also HEADERS
For example:
SUBDIRS = kernel \ tools
For example:
TEMPLATE = app TARGET = myapp SOURCES = main.cpp
The above project file would produce an executable named 'myapp' on unix and 'myapp.exe' on windows.
For example:
TEMPLATE = lib SOURCES = main.cpp TARGET = mylib
For example:
YACCSOURCES = moc.y
The following variables are also recognized by qmake but are either internal or very rarely used.
Also see this note.
SOURCES
. The extension of each
source file will 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.
app { #conditional code for 'app' template here }
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.
TEMPLATE option is specified.
- QMAKE_CFLAGS_WARN_ON
- This variable is not empty if the warn_on
TEMPLATE option is specified.
- QMAKE_CLEAN
- ###
- QMAKE_CXXFLAGS_DEBUG
- This variable contains the c++ compiler flags for creating a debug program. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_CXXFLAGS_MT
- This variable contains the c++ compiler flags for creating a multi-threaded program. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_CXXFLAGS_MT_DBG
- This variable contains the c++ compiler flags for creating a debug multi-threaded program. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_CXXFLAGS_MT_DLL
- 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.
- QMAKE_CXXFLAGS_MT_DLLDBG
- This variable contains the c++ compiler flags for creating a multi-threaded debug dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_CXXFLAGS_RELEASE
- This variable contains the c++ compiler flags for creating a non-debug program. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_CXXFLAGS_SHLIB
- 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.
- QMAKE_CXXFLAGS_THREAD
- This variable contains the c++ compiler flags for creating a threaded program. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_CXXFLAGS_WARN_OFF
- 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.
- QMAKE_CXXFLAGS_WARN_ON
- This variable contains the 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_EXTENTION_SHLIB
- ###
- QMAKE_FAILED_REQUIREMENTS
- ###
- QMAKE_FILETAGS
- ###
- QMAKE_HPUX_SHLIB
- unix only
- If not empty. this variable tells qmake to generate the TARGET as an HPUX shared library.
- QMAKE_HPUX_SHLIBS
- unix only
- If not empty. this variable tells qmake to generate the TARGET as an HPUX shared library.
- QMAKE_INCDIR
- ###
- QMAKE_INCDIR_OPENGL
- This variable contains the location of OpenGL header files. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_INCDIR_QT
- This variable contains the location of all known header files paths. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_INCDIR_THREAD
- This variable contains the location of all known header files paths when building threaded programs. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_INCDIR_X11
- unix only
This variable contains the location of X11 header files paths. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LFLAGS_CONSOLE
- 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.
- QMAKE_LFLAGS_CONSOLE_ANY
- 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.
- QMAKE_LFLAGS_CONSOLE_DLL
- 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.
- QMAKE_LFLAGS_DEBUG
- This variable contains link flags when building debug programs.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LFLAGS_PLUGIN
- 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.
- QMAKE_LFLAGS_QT_DLL
- This variable contains link flags when building programs that use the Qt library built as a dll. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LFLAGS_RELEASE
- This variable contains link flags when building release programs. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LFLAGS_SHAPP
- ###
- QMAKE_LFLAGS_SHLIB
- 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.
- QMAKE_LFLAGS_SONAME
- ###
- QMAKE_LFLAGS_THREAD
- This variable contains link flags when building threaded projects. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LFLAGS_WINDOWS
- 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.
- QMAKE_LFLAGS_WINDOWS_ANY
- 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.
- QMAKE_LFLAGS_WINDOWS_DLL
- 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.
- QMAKE_LIBDIR
- 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.
- QMAKE_LIBDIR_FLAGS
###?
- This variable contains the location of all library directory flags.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LIBDIR_OPENGL
- 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.
- QMAKE_LIBDIR_QT
- This variable contains the location of the Qt library directory.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LIBDIR_X11
- 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.
- QMAKE_LIBS
- 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.
- QMAKE_LIBS_CONSOLE
- ###
- QMAKE_LIBS_OPENGL
- 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.
- QMAKE_LIBS_OPENGL_QT
- This variable contains all OpenGL Qt libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LIBS_QT
- This variable contains all Qt libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LIBS_QT_DLL
- This variable contains all Qt dll libraries.The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
- QMAKE_LIBS_QT_OPENGL
- ###
- QMAKE_LIBS_QT_THREAD
- ###
- QMAKE_LIBS_RT
- ###
- QMAKE_LIBS_RTMT
- ###
- QMAKE_LIBS_THREAD
- ###
- QMAKE_LIBS_WINDOWS
- 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.
- QMAKE_LIBS_X11
- 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.
- QMAKE_LIBS_X11SM
- 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.
- QMAKE_LIB_FLAG
- ###
- QMAKE_LINK_SHLIB_CMD
- 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.
- QMAKE_LN_SHLIB
- 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.
- QMAKE_MAKEFILE
- 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.
- QMAKE_MAX_FILES
- ###
- QMAKE_MOC_SRC
- This variable contains the names of all moc 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.
- QMAKE_NOFORCE
- ###
- QMAKE_QMAKE
- ###
- QMAKE_QT_DLL
- ###
- QMAKE_RUN_CC
- ###
- QMAKE_RUN_CC_IMP
- ###
- QMAKE_RUN_CXX
- ###
- QMAKE_RUN_CXX_IMP
- ###
- QMAKE_TARGET
- 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.
- RC_FILE
- ###
- RES_FILE
- ###
- SUBLIBS
- ###
- TARGET_EXT
- ###
- TARGET_x
- ###
- TARGET_x.y.z
- ###
- UICIMPLS
- ###
- UICOBJECTS
- ###
- VER_MAJ
- This variable contains the major version number of the library, if the 'lib' TEMPLATE is specified.
- VER_MIN
- This variable contains the minor version number of the library, if the 'lib' TEMPLATE is specified.
- VER_PAT
- This variable contains the patch version number of the library, if the 'lib' TEMPLATE is specified.
- YACCIMPLS
- 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.
- YACCOBJECTS
- 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.
* For all project files that specify a directory and are interpreted by qmake (DESTDIR, OBJECTS_DIR, MOC_DIR, etc) the directory will be created when qmake is called, ie before the 'make' command is specified. This is to assure portablity.
For a higher level introduction to using qmake functions see the qmake User's Guide.
qmake recognizes the following functions:
include( filename )
For example:
include( shared.pri ) OPTIONS = standard custom !include( options.pri ) { message( "No custom build options specified" ) OPTIONS -= custom }
contains( variablename, value )
For example:
contains( drivers, network ) { # drivers contains 'network' message( "Configuring for network build..." ) HEADERS += network.h SOURCES += network.cpp }
count( variablename, number )
For example:
MYVAR = one two three count( MYVAR, 3 ) { # always true }
isEmpty( variablename )
count(variable, 0)
).
system( command )
For example:
system(ls /bin):HAS_BIN=FALSE
message( string )
error( string )
For example:
release:debug:error(You can't have release and debug at the same time!)
For a higher level introduction to using qmake environment variables and configuration options see the qmake User's Guide.
qmake requires a platform and compiler description file which contains many default values used to generate appropriate makefiles. The standard Qt distribution comes with many of these files, located in the 'mkspecs' subdirectory of the Qt installation.
The QMAKESPEC environment variable can contain any of the following:
Note: the QMAKESPEC path will automatically be added to the INCLUDEPATHS system variable.
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 neither -path nor -nocache are 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.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta1-beta1
|