📄 qmake-manual-7.html
字号:
<p>Defines the header files for the project.</p><p><em>qmake</em> will generate dependency information (unless -nodepend is specified on the <a href="qmake-manual-7.html#Commands">command line</a>) for the specified headers. <em>qmake</em> will also automatically detect if <em>moc</em> is required by the classes in these headers, and add the appropriate dependencies and files to the project for generating and linking the moc files.</p><p>For example:</p><pre>HEADERS = myclass.h \ login.h \ mainwindow.h</pre><p>See also <a href="qmake-manual-7.html#SOURCES">SOURCES</a>.</p><a name="INCLUDEPATH"></a><h5><a name="4-1-7"></a>INCLUDEPATH</h5><p>This variable specifies the #include directories which should be searched when compiling the project. Use ';' or a space as the directory separator.</p><p>For example:</p><pre> INCLUDEPATH = c:\msdev\include d:\stl\include</pre><a name="FORMS"></a><h5><a name="4-1-8"></a>FORMS</h5><p>This variable specifies the .ui files (see <a href="designer-manual.html">Qt Designer</a>) to be processed through <em>uic</em> before compiling. All dependencies, headers and source files required to build these .ui files will automatically be added to the project.</p><p>For example:</p><pre>FORMS = mydialog.ui \ mywidget.ui \ myconfig.ui</pre><a name="LEXSOURCES"></a><h5><a name="4-1-9"></a>LEXSOURCES</h5><p>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.</p><p>For example:</p><pre>LEXSOURCES = lexer.l</pre><a name="LIBS"></a><h5><a name="4-1-10"></a>LIBS</h5><p>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.</p><p>For example:</p><pre>unix:LIBS += -lmath -L/usr/local/libwin32:LIBS += c:\mylibs\math.lib</pre><a name="MOC_DIR"></a><h5><a name="4-1-11"></a>MOC_DIR</h5><p>This variable specifies the directory where all intermediate moc files should be placed.</p><p>For example:</p><pre>unix:MOC_DIR = ../myproject/tmpwin32:MOC_DIR = c:\myproject\tmp</pre><a name="OBJECTS_DIR"></a><h5><a name="4-1-12"></a>OBJECTS_DIR</h5><p>This variable specifies the directory where all intermediate objects should be placed.</p><p>For example:</p><pre>unix:OBJECTS_DIR = ../myproject/tmpwin32:OBJECTS__DIR = c:\myproject\tmp</pre><a name="UI_DIR"></a><h5><a name="4-1-13"></a>UI_DIR</h5><p>This variable specifies the directory where all intermediate files from uic should be placed. This variable overrides both UI_SOURCES_DIR and UI_HEADERS_DIR.</p><p>For example:</p><pre>unix:UI_DIR = ../myproject/uiwin32:UI_DIR = c:\myproject\ui</pre><a name="UI_HEADERS_DIR"></a><h5><a name="4-1-14"></a>UI_HEADERS_DIR</h5><p>This variable specifies the directory where all declaration files (as generated by uic) should be placed.</p><p>For example:</p><pre>unix:UI_HEADERS_DIR = ../myproject/ui/includewin32:UI_HEADERS_DIR = c:\myproject\ui\include</pre><a name="UI_SOURCES_DIR"></a><h5><a name="4-1-15"></a>UI_SOURCES_DIR</h5><p>This variable specifies the directory where all implementation files (as generated by uic) should be placed.</p><p>For example:</p><pre>unix:UI_SOURCES_DIR = ../myproject/ui/srcwin32:UI_SOURCES_DIR = c:\myproject\ui\src</pre><a name="REQUIRES"></a><h5><a name="4-1-16"></a>REQUIRES</h5><p>This is a special variable processed by <em>qmake</em>. 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.</p><p>This is mainly used in Qt's build system for building the examples.</p><a name="SOURCES"></a><h5><a name="4-1-17"></a>SOURCES</h5><p>This variable contains the name of all source files in the project.</p><p>For example:</p><pre>SOURCES = myclass.cpp \ login.cpp \ mainwindow.cpp</pre><p>See also <a href="qmake-manual-7.html#HEADERS">HEADERS</a></p><h5><a name="4-1-18"></a>SUBDIRS</h5><p>This variable, when used with the 'subdir' <a href="qmake-manual-7.html#TEMPLATE">TEMPLATE</a> contains the names of all subdirectories to look for a project file.</p><p>For example:</p><pre>SUBDIRS = kernel \ tools</pre><a name="TARGET"></a><h5><a name="4-1-19"></a>TARGET</h5><p>This specifies the name of the target file.</p><p>For example:</p><pre>TEMPLATE = appTARGET = myappSOURCES = main.cpp</pre><p>The project file above would produce an executable named 'myapp' on unix and 'myapp.exe' on windows.</p><a name="TEMPLATE"></a><h5><a name="4-1-20"></a>TEMPLATE</h5><p>This variable contains the name of the template to use when generating the project. The allowed values are:</p><ul><li><p>app - Creates a makefile for building applications (the default)</p><li><p>lib - Creates a makefile for building libraries</p><li><p>subdirs - Creates a makefile for building targets in subdirectories</p><li><p>vcapp - <em>win32 only</em> Creates an application project file</p><li><p>vclib - <em>win32 only</em> Creates a library project file</p></ul><p>For example:</p><pre>TEMPLATE = libSOURCES = main.cppTARGET = mylib</pre><h5><a name="4-1-21"></a>VERSION</h5><p>This variable contains the version number of the library if the 'lib' <a href="qmake-manual-7.html#TEMPLATE">TEMPLATE</a> is specified.</p><p>For example:</p><pre>VERSION = 1.2.3</pre><h5><a name="4-1-22"></a>DISTFILES</h5><p>This variable contains a list of files to be included in the dist target. This feature is supported by UnixMake specs only.</p><p>For example:</p><pre>DISTFILES += ../program.txt</pre><a name="YACCSOURCES"></a><h5><a name="4-1-23"></a>YACCSOURCES</h5><p>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.</p><p>For example:</p><pre>YACCSOURCES = moc.y</pre><a name="RarelyUsedSystemVariables"></a><h4><a name="4-2"></a>Rarely Used System Variables</h4>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -