qmake
provides a project-oriented system for managing the buildprocess for applications, libraries, and other components. This approach gives developers control over the source files used, and allows each of the steps in the process to be described concisely, typically within a single file.
qmake
expands the information in each project file to a Makefile that executes the necessary commands for compiling and linking.
In this document, we provide a basic introduction to project files, describe some of the main features of
qmake
, and show how to use
qmake
on the command line.
工程的描述通过其内容在工程 (
.pro
) files. The information within these is used by
qmake
to generate a Makefile containing all the commands that are needed to build each project. Project files typically contain a list of source and header files, general configuration information, and any application-specific details, such as a list of extra libraries to link against, or a list of extra include paths to use.
Project files can contain a number of different elements, including comments, variable declarations, built-in functions, and some simple control structures. In most simple projects, it is only necessary to declare the source and header files that are used to build the project with some basic configuration options.
Complete examples of project files can be found in the qmake Tutorial . An introduction to project files can be found in the qmake Project Files chapter, and a more detailed description is available in the qmake Reference .
For simple projects, you only need to run
qmake
in the top level directory of your project. By default,
qmake
generates a Makefile that you then use to build the project, and you can then run your platform's
make
tool to build the project.
qmake
can also be used to generate project files. A full description of
qmake
's command line options can be found in the
运行 qmake
chapter of this manual.
In large projects, it is possible to take advantage of precompiled header files to speed up the build process. This feature is described in detail in the 使用预编译头 章节。