📄 qmake-manual-7.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/qmake/book/qmake-commandreference.leaf:3 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>qmake Command Reference</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><p align="right">[<a href="qmake-manual-6.html">Prev: qmake's Advanced Concepts</a>] [<a href="qmake-manual.html">Home</a>]</p><h2 align="center">qmake Command Reference</h2><h3><a name="1"></a>qmake Command Reference</h3><ul><li><p><a href="qmake-manual-7.html#About">About This Reference</a></p><li><p><a href="qmake-manual-7.html#Commands">Command Line Options</a></p><li><p><a href="qmake-manual-7.html#SystemVariables">System Variables</a></p><li><p><a href="qmake-manual-7.html#Functions">Functions</a></p><li><p><a href="qmake-manual-7.html#Environment">Environment Variables and Configuration</a></p></ul><a name="About"></a><h3><a name="2"></a>About This Reference</h3><p>This reference is a detailed index of all command line options, configurations and internal variables used by the cross-platform makefile generation utility <em>qmake</em>.</p><p>In addition to the variables and functions described in the following sections, <em>qmake</em> project files may also include comments. Comments begin with the '#' symbol and run to the end of the line.</p><a name="Commands"></a><h3><a name="3"></a>Command Line Options</h3><h4><a name="3-1"></a>Syntax</h4><pre>qmake [options] files</pre><h4><a name="3-2"></a>Options</h4><p>The following options can be specified on the command line to <em>qmake</em>:</p><ul><li><p><tt>-o</tt> file <br> <em>qmake</em> output will be directed to <em>file</em>. if this argument is not specified, then <em>qmake</em> will try to guess a suitable name. If '-' is specified, output is directed to stdout.</p><li><p><tt>-unix</tt> <br> <em>qmake</em> 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.</p><li><p><tt>-macx</tt> <br> <em>qmake</em> 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.</p><li><p><tt>-win32</tt> <br> <em>qmake</em> 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.</p><li><p><tt>-d</tt> <br> <em>qmake</em> will output (hopefully) useful debugging information.</p><li><p><tt>-t</tt> tmpl <br> <em>qmake</em> will override any set TEMPLATE variables with tmpl.</p><li><p><tt>-help</tt> <br> <em>qmake</em> will go over these features and give some useful help.</p></ul><p>There are also warning options that can help to find problems in your project file:</p><ul><li><p><tt>-Wall</tt> <br> With this <em>qmake</em> will turn on all known warnings.</p><li><p><tt>-Wnone</tt> <br> No warning information will be generated by <em>qmake</em>.</p><li><p><tt>-Wparser</tt> <br> <em>qmake</em> will only generate parser warnings, this will alert you to common pitfalls, and potential problems in the parsing of your .pro files.</p><li><p><tt>-Wlogic</tt> <br> Again <em>qmake</em> 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.</p></ul><p><em>qmake</em> supports two different modes of operation. The first mode, which is the default is makefile generation. In this mode, <em>qmake</em> 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.</p><p>To toggle between these modes you must specify in the first argument what mode you want to use. If no mode is specified, <em>qmake</em> will assume you want makefile mode. The available modes are:</p><ul><li><p><tt>-makefile</tt> <br> <em>qmake</em> output will be a makefile (<a href="qmake-manual-7.html#MakefileMode">Makefile mode</a>).</p><li><p><tt>-project</tt> <br> <em>qmake</em> output will be a project file (<a href="qmake-manual-7.html#ProjectfileMode">Project file mode</a>).</p></ul><a name="MakefileMode"></a><h5><a name="3-2-1"></a>Makefile Mode</h5><p>In Makefile mode <em>qmake</em> will generate a makefile. Additionally you may supply the following arguments in this mode:</p><ul><li><p><tt>-after</tt> <br> <em>qmake</em> will process assignments given on the commandline after the specified files.</p><li><p><tt>-nocache</tt> <br> <em>qmake</em> will ignore the .qmake.cache file.</p><li><p><tt>-nodepend</tt> <br> <em>qmake</em> will not generate any dependency information.</p><li><p><tt>-cache</tt> file <br> <em>qmake</em> will use <em>file</em> as the cache file, ignoring any other .qmake.cache file found</p><li><p><tt>-spec</tt> spec <br> <em>qmake</em> will use <em>spec</em> as a path to platform-compiler information and QMAKESPEC will be ignored.</p></ul><p>The <tt>files</tt> 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:</p><p>qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro</p><p>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.</p><p>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:</p><p>qmake "CONFIG+=test" test.pro</p><a name="ProjectfileMode"></a><h5><a name="3-2-2"></a>Projectfile Mode</h5><p>In Projectfile mode <em>qmake</em> will generate a project file. Additionally, you may supply the following arguments in this mode:</p><ul><li><p><tt>-r</tt> <br> <em>qmake</em> will look through supplied directories recursively</p><li><p><tt>-nopwd</tt> <br> <em>qmake</em> will not look in your current working directory for source code and only use the specified <tt>files</tt></p></ul><p>The <tt>files</tt> argument can be a list of files or directories. If a directory is specified, then it will be included in the <a href="qmake-manual-7.html#DEPENDPATH">DEPENDPATH</a> 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.</p><a name="SystemVariables"></a><h3><a name="4"></a>System Variables</h3><ul><li><p><a href="qmake-manual-7.html#FrequentlyUsedSystemVariables">Frequently Used System Variables</a></p><li><p><a href="qmake-manual-7.html#RarelyUsedSystemVariables">Rarely Used System Variables</a></p></ul><a name="FrequentlyUsedSystemVariables"></a><h4><a name="4-1"></a>Frequently Used System Variables</h4><p>The following variables are recognized by <em>qmake</em> and are used most frequently when creating project files.</p><a name="CONFIG"></a><h5><a name="4-1-1"></a>CONFIG</h5><p>The <tt>CONFIG</tt> variable specifies project configuration and compiler options. The values will be recognized internally by <em>qmake</em> and have special meaning. They are as follows.</p><p>These <tt>CONFIG</tt> values control compilation flags:</p><ul><li><p>release - Compile with optimization enabled, ignored if "debug" is specified</p><li><p>debug - Compile with debug options enabled</p><li><p>warn_on - The compiler should emit more warnings than normally, ignored if "warn_off" is specified</p><li><p>warn_off - The compiler should only emit severe warnings.</p></ul><p>These options define the application/library type:</p><ul><li><p>qt - The target is a Qt application/library and requires the Qt header files/library. The proper include and library paths for the Qt library will automatically be added to the project.</p><li><p>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.</p><li><p>thread - The target is a multi-threaded application or library. The proper defines and compiler flags will automatically be added to the project.</p><li><p>x11 - The target is a X11 application or library. The proper include paths and libraries will automatically be added to the project.</p><li><p>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.</p><li><p>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.</p><li><p>dll - The target is a shared object/DLL.The proper include paths, compiler flags and libraries will automatically be added to the project.</p><li><p>staticlib - The target is a static library (lib only). The proper compiler flags will automatically be added to the project.</p><li><p>plugin - The target is a plugin (lib only). This enables dll as well.</p></ul><p>The <tt>CONFIG</tt> variable will also be checked when resolving scopes. You may assign anything to this variable.</p><p>For example:</p><pre>CONFIG += qt console newstuff...newstuff { SOURCES += new.cpp HEADERS += new.h}</pre><a name="DEFINES"></a><h5><a name="4-1-2"></a>DEFINES</h5><p><em>qmake</em> adds the values of this variable as compiler C preprocessor macros (-D option).</p><p>For example:</p><pre> DEFINES += USE_MY_STUFF QT_DLL</pre><a name="DEF_FILE"></a><h5><a name="4-1-3"></a>DEF_FILE</h5><p><em>This is only used on Windows when using the 'app' template</em>.</p><p>Specifies a .def file to be included in the project.</p><a name="DESTDIR"></a><h5><a name="4-1-4"></a>DESTDIR</h5><p>Specifies where to put the <a href="qmake-manual-7.html#TARGET">target</a> file.</p><p>For example:</p><pre> DESTDIR = ../../lib</pre><a name="DLLDESTDIR"></a><h5><a name="4-1-5"></a>DLLDESTDIR</h5><p>Specifies where to copy the <a href="qmake-manual-7.html#TARGET">target</a> dll.</p><a name="HEADERS"></a><h5><a name="4-1-6"></a>HEADERS</h5>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -