1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information (qt-info@nokia.com)
|
---|
5 | **
|
---|
6 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at qt-sales@nokia.com.
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | /*!
|
---|
43 | \page qmake-manual.html
|
---|
44 | \title qmake Manual
|
---|
45 | \startpage {index.html}{Qt Reference Documentation}
|
---|
46 | \nextpage qmake Tutorial
|
---|
47 |
|
---|
48 | \ingroup buildsystem
|
---|
49 | \ingroup qttools
|
---|
50 | \keyword qmake
|
---|
51 |
|
---|
52 | \c qmake is a tool that helps simplify the build
|
---|
53 | process for development project across different platforms. \c qmake
|
---|
54 | automates the generation of Makefiles so that only a few lines of
|
---|
55 | information are needed to create each Makefile. \c qmake can be used for
|
---|
56 | any software project, whether it is written in Qt or not.
|
---|
57 |
|
---|
58 | \c qmake generates a Makefile based on the information in a project
|
---|
59 | file. Project files are created by the developer, and are usually
|
---|
60 | simple, but more sophisticated project files can be created for
|
---|
61 | complex projects.
|
---|
62 | \c qmake contains additional features to support development with Qt,
|
---|
63 | automatically including build rules for \l{moc.html}{moc}
|
---|
64 | and \l{uic.html}{uic}.
|
---|
65 | \c qmake can also generate projects for Microsoft Visual studio
|
---|
66 | without requiring the developer to change the project file.
|
---|
67 |
|
---|
68 | \section1 Getting Started
|
---|
69 |
|
---|
70 | The \l{qmake Tutorial} and guide to \l{qmake Common Projects} provide overviews
|
---|
71 | that aim to help new users get started with \c qmake.
|
---|
72 |
|
---|
73 | \list
|
---|
74 | \o \l{qmake Tutorial}
|
---|
75 | \tableofcontents{1 qmake Tutorial}
|
---|
76 | \endlist
|
---|
77 |
|
---|
78 | \list
|
---|
79 | \o \l{qmake Common Projects}
|
---|
80 | \tableofcontents{1 qmake Common Projects}
|
---|
81 | \endlist
|
---|
82 |
|
---|
83 | \section1 Table of Contents
|
---|
84 |
|
---|
85 | \list
|
---|
86 | \o \l{Using qmake}
|
---|
87 | \tableofcontents{1 Using qmake}
|
---|
88 | \o \l{qmake Project Files}
|
---|
89 | \tableofcontents{1 qmake Project Files}
|
---|
90 | \o \l{Running qmake}
|
---|
91 | \tableofcontents{1 Running qmake}
|
---|
92 | \o \l{qmake Platform Notes}
|
---|
93 | \tableofcontents{1 qmake Platform Notes}
|
---|
94 | \o \l{qmake Advanced Usage}
|
---|
95 | \tableofcontents{1 qmake Advanced Usage}
|
---|
96 | \o \l{Using Precompiled Headers}
|
---|
97 | \tableofcontents{1 Using Precompiled Headers}
|
---|
98 | \o \l{qmake Reference}
|
---|
99 | \tableofcontents{1 qmake Reference}
|
---|
100 | \o \l{qmake Variable Reference}
|
---|
101 | \tableofcontents{1 qmake Variable Reference}
|
---|
102 | \o \l{qmake Function Reference}
|
---|
103 | \tableofcontents{1 qmake Function Reference}
|
---|
104 | \o \l{Configuring qmake's Environment}
|
---|
105 | \tableofcontents{1 Configuring qmake's Environment}
|
---|
106 | \endlist
|
---|
107 | */
|
---|
108 |
|
---|
109 | /*!
|
---|
110 | \page qmake-using.html
|
---|
111 | \title Using qmake
|
---|
112 | \contentspage {qmake Manual}{Contents}
|
---|
113 | \previouspage qmake Manual
|
---|
114 | \nextpage qmake Project Files
|
---|
115 |
|
---|
116 | \c qmake provides a project-oriented system for managing the build
|
---|
117 | process for applications, libraries, and other components. This
|
---|
118 | approach gives developers control over the source files used, and
|
---|
119 | allows each of the steps in the process to be described concisely,
|
---|
120 | typically within a single file. \c qmake expands the information in
|
---|
121 | each project file to a Makefile that executes the necessary commands
|
---|
122 | for compiling and linking.
|
---|
123 |
|
---|
124 | In this document, we provide a basic introduction to project files,
|
---|
125 | describe some of the main features of \c qmake, and show how to use
|
---|
126 | \c qmake on the command line.
|
---|
127 |
|
---|
128 | \section1 Describing a Project
|
---|
129 |
|
---|
130 | Projects are described by the contents of project (\c .pro) files.
|
---|
131 | The information within these is used by \c qmake to generate a Makefile
|
---|
132 | containing all the commands that are needed to build each project.
|
---|
133 | Project files typically contain a list of source and header files,
|
---|
134 | general configuration information, and any application-specific details,
|
---|
135 | such as a list of extra libraries to link against, or a list of extra
|
---|
136 | include paths to use.
|
---|
137 |
|
---|
138 | Project files can contain a number of different elements, including
|
---|
139 | comments, variable declarations, built-in functions, and some simple
|
---|
140 | control structures. In most simple projects, it is only necessary
|
---|
141 | to declare the source and header files that are used to build the
|
---|
142 | project with some basic configuration options.
|
---|
143 |
|
---|
144 | Complete examples of project files can be found in the
|
---|
145 | \l{qmake Tutorial}.
|
---|
146 | An introduction to project files can be found in the
|
---|
147 | \l{qmake Project Files} chapter, and a more detailed description is
|
---|
148 | available in the \l{qmake Reference}.
|
---|
149 |
|
---|
150 | \section1 Building a Project
|
---|
151 |
|
---|
152 | For simple projects, you only need to run \c qmake in the top
|
---|
153 | level directory of your project. By default, \c qmake generates a
|
---|
154 | Makefile that you then use to build the project, and you can then
|
---|
155 | run your platform's \c make tool to build the project.
|
---|
156 |
|
---|
157 | \c qmake can also be used to generate project files. A full
|
---|
158 | description of \c{qmake}'s command line options can be found in the
|
---|
159 | \l{Running qmake} chapter of this manual.
|
---|
160 |
|
---|
161 | \section1 Using Precompiled Headers
|
---|
162 |
|
---|
163 | In large projects, it is possible to take advantage of precompiled
|
---|
164 | header files to speed up the build process. This feature is described
|
---|
165 | in detail in the \l{Using Precompiled Headers} chapter.
|
---|
166 | */
|
---|
167 |
|
---|
168 | /*!
|
---|
169 | \page qmake-project-files.html
|
---|
170 | \title qmake Project Files
|
---|
171 | \contentspage {qmake Manual}{Contents}
|
---|
172 | \previouspage Using qmake
|
---|
173 | \nextpage Running qmake
|
---|
174 |
|
---|
175 | Project files contain all the information required by \c qmake to build
|
---|
176 | your application, library, or plugin. The resources used by your project
|
---|
177 | are generally specified using a series of declarations, but support for
|
---|
178 | simple programming constructs allow you to describe different build
|
---|
179 | processes for different platforms and environments.
|
---|
180 |
|
---|
181 | \tableofcontents
|
---|
182 |
|
---|
183 | \section1 Project File Elements
|
---|
184 |
|
---|
185 | The project file format used by \c qmake can be used to support both
|
---|
186 | simple and fairly complex build systems. Simple project files will
|
---|
187 | use a straightforward declarative style, defining standard variables
|
---|
188 | to indicate the source and header files that are used in the project.
|
---|
189 | Complex projects may use the control flow structures to fine-tune the
|
---|
190 | build process.
|
---|
191 |
|
---|
192 | The following sections describe the different types of elements used
|
---|
193 | in project files.
|
---|
194 |
|
---|
195 | \section2 Variables
|
---|
196 |
|
---|
197 | In a project file, variables are used to hold lists of strings.
|
---|
198 | In the simplest projects, these variables inform \c qmake about the
|
---|
199 | configuration options to use, or supply filenames and paths to use
|
---|
200 | in the build process.
|
---|
201 |
|
---|
202 | \c qmake looks for certain variables in each project file, and it
|
---|
203 | uses the contents of these to determine what it should write to a
|
---|
204 | Makefile. For example, the list of values in the \c HEADERS and
|
---|
205 | \c SOURCES variables are used to tell \c qmake about header and
|
---|
206 | source files in the same directory as the project file.
|
---|
207 |
|
---|
208 | Variables can also be used internally to store temporary lists of values,
|
---|
209 | and existing lists of values can be overwritten or extended with new
|
---|
210 | values.
|
---|
211 |
|
---|
212 | The following lines show how lists of values are assigned to variables:
|
---|
213 |
|
---|
214 | \snippet doc/src/snippets/qmake/variables.pro 0
|
---|
215 |
|
---|
216 | Note that the first assignment only includes values that are specified on
|
---|
217 | the same line as the \c SOURCES variable. The second assignment splits
|
---|
218 | the items across lines by using the \c \\ character.
|
---|
219 |
|
---|
220 | The list of values in a variable is extended in the following way:
|
---|
221 |
|
---|
222 | \snippet doc/src/snippets/qmake/variables.pro 1
|
---|
223 |
|
---|
224 | The \c CONFIG variable is another special variable that \c qmake
|
---|
225 | uses when generating a Makefile. It is discussed in the section on
|
---|
226 | \l{#GeneralConfiguration}{general configuration} later in this chapter.
|
---|
227 | In the above line, \c qt is added to the list of existing values
|
---|
228 | contained in \c CONFIG.
|
---|
229 |
|
---|
230 | The following table lists the variables that \c qmake recognizes, and
|
---|
231 | describes what they should contain.
|
---|
232 |
|
---|
233 | \table
|
---|
234 | \header \o Variable \o Contents
|
---|
235 | \row \o CONFIG \o General project configuration options.
|
---|
236 | \row \o DESTDIR \o The directory in which the executable or binary file will
|
---|
237 | be placed.
|
---|
238 | \row \o FORMS \o A list of .ui files to be processed by \c uic.
|
---|
239 | \row \o HEADERS \o A list of filenames of header (.h) files used when
|
---|
240 | building the project.
|
---|
241 | \row \o QT \o Qt-specific configuration options.
|
---|
242 | \row \o RESOURCES \o A list of resource (.rc) files to be included in the
|
---|
243 | final project. See the \l{The Qt Resource System} for
|
---|
244 | more information about these files.
|
---|
245 | \row \o SOURCES \o A list of source code files to be used when building
|
---|
246 | the project.
|
---|
247 | \row \o TEMPLATE \o The template to use for the project. This determines
|
---|
248 | whether the output of the build process will be an
|
---|
249 | application, a library, or a plugin.
|
---|
250 | \endtable
|
---|
251 |
|
---|
252 | The contents of a variable can be read by prepending the variable name with
|
---|
253 | \c $$. This can be used to assign the contents of one variable to another:
|
---|
254 |
|
---|
255 | \snippet doc/src/snippets/qmake/dereferencing.pro 0
|
---|
256 |
|
---|
257 | The \c $$ operator is used extensively with built-in functions that operate
|
---|
258 | on strings and lists of values. These are described in the chapter on
|
---|
259 | \l{qmake Advanced Usage}.
|
---|
260 |
|
---|
261 | Normally, variables are used to contain whitespace-separated lists
|
---|
262 | of values. However, it is sometimes necessary to specify values containing
|
---|
263 | spaces. These must be quoted in the following way:
|
---|
264 |
|
---|
265 | \snippet doc/src/snippets/qmake/quoting.pro 0
|
---|
266 |
|
---|
267 | The quoted text is treated as a single item in the list of values held by
|
---|
268 | the variable.
|
---|
269 |
|
---|
270 | \section2 Comments
|
---|
271 |
|
---|
272 | You can add comments to project files. Comments begin with the \c
|
---|
273 | # character and continue to the end of the same line. For example:
|
---|
274 |
|
---|
275 | \snippet doc/src/snippets/qmake/comments.pro 0
|
---|
276 |
|
---|
277 | To include the \c # character in variable assignments, it is necessary
|
---|
278 | to use the contents of the built-in \c LITERAL_HASH variable. See the
|
---|
279 | \l{qmake Variable Reference#LITERAL_HASH}{variable reference} for more
|
---|
280 | information.
|
---|
281 |
|
---|
282 | \section2 Built-in Functions and Control Flow
|
---|
283 |
|
---|
284 | \c qmake provides a number of built-in functions to allow the contents
|
---|
285 | of variables to be processed. The most commonly used function in simple
|
---|
286 | project files is the \c include function which takes a filename as an
|
---|
287 | argument. The contents of the given file are included in the project
|
---|
288 | file at the place where the \c include function is used.
|
---|
289 | The \c include function is most commonly used to include other project
|
---|
290 | files:
|
---|
291 |
|
---|
292 | \snippet doc/src/snippets/qmake/include.pro 0
|
---|
293 |
|
---|
294 | Support for conditional structures is made available via
|
---|
295 | \l{qmake Advanced Usage#scopes}{scopes} that behave like \c if
|
---|
296 | statements in programming languages:
|
---|
297 |
|
---|
298 | \snippet doc/src/snippets/qmake/scopes.pro 0
|
---|
299 |
|
---|
300 | The assignments inside the braces are only made if the condition is
|
---|
301 | true. In this case, the special \c win32 variable must be set; this
|
---|
302 | happens automatically on Windows, but this can also be specified on
|
---|
303 | other platforms by running \c qmake with the \c{-win32} command line
|
---|
304 | option (see \l{Running qmake} for more information). The opening
|
---|
305 | brace must stand on the same line as the condition.
|
---|
306 |
|
---|
307 | Simple loops are constructed by iterating over lists of values using
|
---|
308 | the built-in \c for function. The following code adds directories
|
---|
309 | to the \l{qmake Variable Reference#SUBDIRS}{SUBDIRS} variable, but
|
---|
310 | only if they exist:
|
---|
311 |
|
---|
312 | \snippet doc/src/snippets/qmake/functions.pro 0
|
---|
313 |
|
---|
314 | More complex operations on variables that would usually require loops
|
---|
315 | are provided by built-in functions such as \c find, \c unique, and
|
---|
316 | \c count. These functions, and many others are provided to manipulate
|
---|
317 | strings and paths, support user input, and call external tools. A list
|
---|
318 | of the functions available can be found in the
|
---|
319 | \l{qmake Advanced Usage} chapter of this manual.
|
---|
320 |
|
---|
321 | \section1 Project Templates
|
---|
322 |
|
---|
323 | The \c TEMPLATE variable is used to define the type of project that will
|
---|
324 | be built. If this is not declared in the project file, \c qmake assumes
|
---|
325 | that an application should be built, and will generate an appropriate
|
---|
326 | Makefile (or equivalent file) for the purpose.
|
---|
327 |
|
---|
328 | The types of project available are listed in the following table with
|
---|
329 | information about the files that \c qmake will generate for each of them:
|
---|
330 |
|
---|
331 | \table
|
---|
332 | \header \o Template \o Description of \c qmake output
|
---|
333 | \row \o app (default) \o Creates a Makefile to build an application.
|
---|
334 | \row \o lib \o Creates a Makefile to build a library.
|
---|
335 | \row \o subdirs \o Creates a Makefile containing rules for the
|
---|
336 | subdirectories specified using the \l{qmake Variable Reference#SUBDIRS}{SUBDIRS}
|
---|
337 | variable. Each subdirectory must contain its own project file.
|
---|
338 | \row \o vcapp \o Creates a Visual Studio Project file to build
|
---|
339 | an application.
|
---|
340 | \row \o vclib \o Creates a Visual Studio Project file to build a library.
|
---|
341 | \endtable
|
---|
342 |
|
---|
343 | See the \l{qmake Tutorial} for advice on writing project files for
|
---|
344 | projects that use the \c app and \c lib templates.
|
---|
345 |
|
---|
346 | When the \c subdirs template is used, \c qmake generates a Makefile
|
---|
347 | to examine each specified subdirectory, process any project file it finds
|
---|
348 | there, and run the platform's \c make tool on the newly-created Makefile.
|
---|
349 | The \l{qmake Variable Reference#SUBDIRS}{SUBDIRS} variable is used to
|
---|
350 | contain a list of all the subdirectories to be processed.
|
---|
351 |
|
---|
352 | \target GeneralConfiguration
|
---|
353 | \section1 General Configuration
|
---|
354 |
|
---|
355 | The \l{qmake Variable Reference#CONFIG}{CONFIG variable} specifies the
|
---|
356 | options and features that the compiler should use and the libraries that
|
---|
357 | should be linked against. Anything can be added to the \c CONFIG variable,
|
---|
358 | but the options covered below are recognized by \c qmake internally.
|
---|
359 |
|
---|
360 | The following options control the compiler flags that are used to build the
|
---|
361 | project:
|
---|
362 |
|
---|
363 | \table
|
---|
364 | \header \o Option \o Description
|
---|
365 | \row \o release \o The project is to be built in release mode.
|
---|
366 | This is ignored if \c debug is also specified.
|
---|
367 | \row \o debug \o The project is to be built in debug mode.
|
---|
368 | \row \o debug_and_release \o The project is built in \e both debug and
|
---|
369 | release modes.
|
---|
370 | \row \o debug_and_release_target \o The project is built in \e both debug
|
---|
371 | and release modes. TARGET is built into \e both the debug and release directories.
|
---|
372 | \row \o build_all \o If \c debug_and_release is specified, the project is
|
---|
373 | built in both debug and release modes by default.
|
---|
374 | \row \o autogen_precompile_source \o Automatically generates a \c .cpp file that includes
|
---|
375 | the precompiled header file specified in the .pro file.
|
---|
376 | \row \o ordered \o When using the \c subdirs template, this option
|
---|
377 | specifies that the directories listed should be processed in the
|
---|
378 | order in which they are given.
|
---|
379 | \row \o warn_on \o The compiler should output as many warnings as possible.
|
---|
380 | This is ignored if \c warn_off is specified.
|
---|
381 | \row \o warn_off \o The compiler should output as few warnings as possible.
|
---|
382 | \row \o copy_dir_files \o Enables the install rule to also copy directories, not just files.
|
---|
383 | \endtable
|
---|
384 |
|
---|
385 | The \c debug_and_release option is special in that it enables \e both debug and
|
---|
386 | release versions of a project to be built. In such a case, the Makefile that
|
---|
387 | \c qmake generates includes a rule that builds both versions, and this can be
|
---|
388 | invoked in the following way:
|
---|
389 |
|
---|
390 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 0
|
---|
391 |
|
---|
392 | Adding the \c build_all option to the \c CONFIG variable makes this rule
|
---|
393 | the default when building the project, and installation targets will be
|
---|
394 | created for both debug and release builds.
|
---|
395 |
|
---|
396 | Note that each of the options specified in the \c CONFIG variable can also be
|
---|
397 | used as a scope condition.
|
---|
398 | You can test for the presence of certain configuration options by using the
|
---|
399 | built-in \l{qmake Function Reference#CONFIG(config)}{CONFIG()} function.
|
---|
400 | For example, the following lines show the function as the condition in a scope
|
---|
401 | to test whether only the \c opengl option is in use:
|
---|
402 |
|
---|
403 | \snippet doc/src/snippets/qmake/configscopes.pro 4
|
---|
404 | \snippet doc/src/snippets/qmake/configscopes.pro 5
|
---|
405 |
|
---|
406 | This enables different configurations to be defined for \c release and
|
---|
407 | \c debug builds, and is described in more detail in the
|
---|
408 | \l{qmake Advanced Usage#Scopes}{Scopes} section of the
|
---|
409 | \l{qmake Advanced Usage}{Advanced Usage} chapter of this manual.
|
---|
410 |
|
---|
411 | The following options define the type of project to be built. Note that some
|
---|
412 | of these options only take effect when used on the relevant platform. On other
|
---|
413 | platforms, they have no effect.
|
---|
414 |
|
---|
415 | \table
|
---|
416 | \header \o Option \o Description
|
---|
417 | \row \o qt \o The project is a Qt application and should link against the Qt
|
---|
418 | library. You can use the \c QT variable to control any additional
|
---|
419 | Qt modules that are required by your application.
|
---|
420 | \row \o thread \o The project is a multi-threaded application.
|
---|
421 | \row \o x11 \o The project is an X11 application or library.
|
---|
422 | \endtable
|
---|
423 |
|
---|
424 | When using \l{qmake Variable Reference#TEMPLATE}{application or library project
|
---|
425 | templates}, more specialized configuration options can be used to fine tune the
|
---|
426 | build process. These are explained in details in the
|
---|
427 | \l{qmake-common-projects.html}{Common Projects} chapter of this manual.
|
---|
428 |
|
---|
429 | For example, if your application uses the Qt library and you want to
|
---|
430 | build it as a multi-threaded application in \c debug mode, your project
|
---|
431 | file will contain the following line:
|
---|
432 |
|
---|
433 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 1
|
---|
434 |
|
---|
435 | Note, that you must use "+=", not "=", or \c qmake will not be able to
|
---|
436 | use Qt's configuration to determine the settings needed for your project.
|
---|
437 |
|
---|
438 | \section1 Declaring Qt Libraries
|
---|
439 |
|
---|
440 | If the \c CONFIG variable contains the \c qt value, qmake's support for Qt
|
---|
441 | applications is enabled. This makes it possible to fine-tune which of the
|
---|
442 | Qt modules are used by your application. This is achieved with the \c QT
|
---|
443 | variable which can be used to declare the required extension modules.
|
---|
444 | For example, we can enable the XML and network modules in the following way:
|
---|
445 |
|
---|
446 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 2
|
---|
447 |
|
---|
448 | Note that \c QT includes the \c core and \c gui modules by default, so the
|
---|
449 | above declaration \e adds the network and XML modules to this default list.
|
---|
450 | The following assignment \e omits the default modules, and will lead to
|
---|
451 | errors when the application's source code is being compiled:
|
---|
452 |
|
---|
453 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 3
|
---|
454 |
|
---|
455 | If you want to build a project \e without the \c gui module, you need to
|
---|
456 | exclude it with the "-=" operator. By default, \c QT contains both
|
---|
457 | \c core and \c gui, so the following line will result in a minimal
|
---|
458 | Qt project being built:
|
---|
459 |
|
---|
460 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 4
|
---|
461 |
|
---|
462 | The table below shows the options that can be used with the \c QT variable
|
---|
463 | and the features that are associated with each of them:
|
---|
464 |
|
---|
465 | \table
|
---|
466 | \header \o Option \o Features
|
---|
467 | \row \o core (included by default) \o QtCore module
|
---|
468 | \row \o gui (included by default) \o QtGui module
|
---|
469 | \row \o network \o QtNetwork module
|
---|
470 | \row \o opengl \o QtOpenGL module
|
---|
471 | \row \o sql \o QtSql module
|
---|
472 | \row \o svg \o QtSvg module
|
---|
473 | \row \o xml \o QtXml module
|
---|
474 | \row \o xmlpatterns \o QtXmlPatterns module
|
---|
475 | \row \o qt3support \o Qt3Support module
|
---|
476 | \endtable
|
---|
477 |
|
---|
478 | Note that adding the \c opengl option to the \c QT variable automatically
|
---|
479 | causes the equivalent option to be added to the \c CONFIG variable.
|
---|
480 | Therefore, for Qt applications, it is not necessary to add the \c opengl
|
---|
481 | option to both \c CONFIG and \c{QT}.
|
---|
482 |
|
---|
483 | \section1 Configuration Features
|
---|
484 |
|
---|
485 | \c qmake can be set up with extra configuration features that are specified
|
---|
486 | in feature (.prf) files. These extra features often provide support for
|
---|
487 | custom tools that are used during the build process. To add a feature to
|
---|
488 | the build process, append the feature name (the stem of the feature filename)
|
---|
489 | to the \c CONFIG variable.
|
---|
490 |
|
---|
491 | For example, \c qmake can configure the build process to take advantage
|
---|
492 | of external libraries that are supported by
|
---|
493 | \l{http://www.freedesktop.org/wiki/Software_2fpkgconfig}{pkg-config},
|
---|
494 | such as the D-Bus and ogg libraries, with the following lines:
|
---|
495 |
|
---|
496 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 5
|
---|
497 |
|
---|
498 | More information about features can be found in the
|
---|
499 | \l{qmake Advanced Usage#Adding New Configuration Features}
|
---|
500 | {Adding New Configuration Features} section of the \l{qmake Advanced Usage}
|
---|
501 | chapter.
|
---|
502 |
|
---|
503 | \section1 Declaring Other Libraries
|
---|
504 |
|
---|
505 | If you are using other libraries in your project in addition to those
|
---|
506 | supplied with Qt, you need to specify them in your project file.
|
---|
507 |
|
---|
508 | The paths that \c qmake searches for libraries and the specific libraries
|
---|
509 | to link against can be added to the list of values in the
|
---|
510 | \l{qmake Variable Reference#LIBS}{LIBS} variable. The paths to the libraries
|
---|
511 | themselves can be given, or the familiar Unix-style notation for specifying
|
---|
512 | libraries and paths can be used if preferred.
|
---|
513 |
|
---|
514 | For example, the following lines show how a library can be specified:
|
---|
515 |
|
---|
516 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 6
|
---|
517 |
|
---|
518 | The paths containing header files can also be specified in a similar way
|
---|
519 | using the \l{qmake Variable Reference#INCLUDEPATH}{INCLUDEPATH} variable.
|
---|
520 |
|
---|
521 | For example, it is possible to add several paths to be searched for header
|
---|
522 | files:
|
---|
523 |
|
---|
524 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 7
|
---|
525 | */
|
---|
526 |
|
---|
527 | /*!
|
---|
528 | \page qmake-running.html
|
---|
529 | \title Running qmake
|
---|
530 | \contentspage {qmake Manual}{Contents}
|
---|
531 | \previouspage qmake Project Files
|
---|
532 | \nextpage qmake Platform Notes
|
---|
533 |
|
---|
534 | The behavior of \c qmake can be customized when it is run by
|
---|
535 | specifying various options on the command line. These allow the
|
---|
536 | build process to be fine-tuned, provide useful diagnostic
|
---|
537 | information, and can be used to specify the target platform for
|
---|
538 | your project.
|
---|
539 |
|
---|
540 | \tableofcontents
|
---|
541 |
|
---|
542 | \target Commands
|
---|
543 | \section1 Command-Line Options
|
---|
544 |
|
---|
545 | \section2 Syntax
|
---|
546 |
|
---|
547 | The syntax used to run \c qmake takes the following simple form:
|
---|
548 |
|
---|
549 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 8
|
---|
550 |
|
---|
551 | \c qmake supports two different modes of operation: In the default mode,
|
---|
552 | \c qmake will use the description in a project file to generate a Makefile,
|
---|
553 | but it is also possible to use \c qmake to generate project files.
|
---|
554 | If you want to explicitly set the mode, you must specify it before all
|
---|
555 | other options. The \c mode can be either of the following two values:
|
---|
556 |
|
---|
557 | \list
|
---|
558 | \o \c -makefile \BR
|
---|
559 | \c qmake output will be a Makefile.
|
---|
560 | \o \c -project \BR
|
---|
561 | \c qmake output will be a project file.
|
---|
562 | \endlist
|
---|
563 |
|
---|
564 | The following \c options are used to specify both general and mode-specific
|
---|
565 | settings. Options that only apply to the Makefile mode are described in the
|
---|
566 | \l{#MakefileMode}{Makefile Mode Options} section; options that influence the
|
---|
567 | creation of project files are described in the
|
---|
568 | \l{#ProjectMode}{Project File Options} section.
|
---|
569 |
|
---|
570 | The \c files argument represents a list of one or more project files, separated
|
---|
571 | by spaces.
|
---|
572 |
|
---|
573 | \section2 Options
|
---|
574 |
|
---|
575 | A wide range of options can be specified on the command line to \c qmake in
|
---|
576 | order to customize the build process, and to override default settings for
|
---|
577 | your platform. The following basic options provide usage information, specify
|
---|
578 | where \c qmake writes the output file, and control the level of debugging
|
---|
579 | information that will be written to the console:
|
---|
580 |
|
---|
581 | \list
|
---|
582 | \o \c -help \BR
|
---|
583 | \c qmake will go over these features and give some useful help.
|
---|
584 | \o \c -o file \BR
|
---|
585 | \c qmake output will be directed to \e file. If this option
|
---|
586 | is not specified, \c qmake will try to use a suitable file name for its
|
---|
587 | output, depending on the mode it is running in.\BR
|
---|
588 | If '-' is specified, output is directed to stdout.
|
---|
589 | \o \c -d \BR
|
---|
590 | \c qmake will output debugging information.
|
---|
591 | \endlist
|
---|
592 |
|
---|
593 | For projects that need to be built differently on each target platform, with
|
---|
594 | many subdirectories, you can run \c qmake with each of the following
|
---|
595 | options to set the corresponding platform-specific variable in each
|
---|
596 | project file:
|
---|
597 |
|
---|
598 | \list
|
---|
599 | \o \c -unix \BR
|
---|
600 | \c qmake will run in unix mode. In this mode, Unix file
|
---|
601 | naming and path conventions will be used, additionally testing for \c unix
|
---|
602 | (as a scope) will succeed. This is the default mode on all Unices.
|
---|
603 | \o \c -macx \BR
|
---|
604 | \c qmake will run in Mac OS X mode. In this mode, Unix file
|
---|
605 | naming and path conventions will be used, additionally testing for \c macx
|
---|
606 | (as a scope) will succeed. This is the default mode on Mac OS X.
|
---|
607 | \o \c -win32 \BR
|
---|
608 | \c qmake will run in win32 mode. In this mode, Windows file naming and path
|
---|
609 | conventions will be used, additionally testing for \c win32 (as a scope)
|
---|
610 | will succeed. This is the default mode on Windows.
|
---|
611 | \endlist
|
---|
612 |
|
---|
613 | The template used for the project is usually specified by the \c TEMPLATE
|
---|
614 | variable in the project file. We can override or modify this by using the
|
---|
615 | following options:
|
---|
616 |
|
---|
617 | \list
|
---|
618 | \o \c -t tmpl \BR
|
---|
619 | \c qmake will override any set \c TEMPLATE variables with tmpl, but only
|
---|
620 | \e after the .pro file has been processed.
|
---|
621 | \o \c -tp prefix \BR
|
---|
622 | \c qmake will add the prefix to the \c TEMPLATE variable.
|
---|
623 | \endlist
|
---|
624 |
|
---|
625 | The level of warning information can be fine-tuned to help you find problems in
|
---|
626 | your project file:
|
---|
627 |
|
---|
628 | \list
|
---|
629 | \o \c -Wall \BR
|
---|
630 | \c qmake will report all known warnings.
|
---|
631 | \o \c -Wnone \BR
|
---|
632 | No warning information will be generated by \c qmake.
|
---|
633 | \o \c -Wparser \BR
|
---|
634 | \c qmake will only generate parser warnings. This will alert
|
---|
635 | you to common pitfalls and potential problems in the parsing of your
|
---|
636 | project files.
|
---|
637 | \o \c -Wlogic \BR
|
---|
638 | \c qmake will warn of common pitfalls and potential problems in your
|
---|
639 | project file. For example, \c qmake will report whether a file is placed
|
---|
640 | into a list of files multiple times, or if a file cannot be found.
|
---|
641 | \endlist
|
---|
642 |
|
---|
643 | \target MakefileMode
|
---|
644 | \section2 Makefile Mode Options
|
---|
645 |
|
---|
646 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 9
|
---|
647 |
|
---|
648 | In Makefile mode, \c qmake will generate a Makefile that is used to build the
|
---|
649 | project. Additionally, the following options may be used in this mode to
|
---|
650 | influence the way the project file is generated:
|
---|
651 |
|
---|
652 | \list
|
---|
653 | \o \c -after \BR
|
---|
654 | \c qmake will process assignments given on the command line after
|
---|
655 | the specified files.
|
---|
656 | \o \c -nocache \BR
|
---|
657 | \c qmake will ignore the .qmake.cache file.
|
---|
658 | \o \c -nodepend \BR
|
---|
659 | \c qmake will not generate any dependency information.
|
---|
660 | \o \c -cache file \BR
|
---|
661 | \c qmake will use \e file as the cache file, ignoring any other
|
---|
662 | .qmake.cache files found.
|
---|
663 | \o \c -spec spec \BR
|
---|
664 | \c qmake will use \e spec as a path to platform and compiler information,
|
---|
665 | and the value of \c QMAKESPEC will be ignored.
|
---|
666 | \endlist
|
---|
667 |
|
---|
668 | You may also pass \c qmake assignments on the command line;
|
---|
669 | they will be processed before all of the files specified. For example:
|
---|
670 |
|
---|
671 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 10
|
---|
672 |
|
---|
673 | This will generate a Makefile, from test.pro with Unix pathnames. However
|
---|
674 | many of the specified options aren't necessary as they are the default.
|
---|
675 | Therefore, the line can be simplified on Unix to:
|
---|
676 |
|
---|
677 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 11
|
---|
678 |
|
---|
679 | If you are certain you want your variables processed after the
|
---|
680 | files specified, then you may pass the \c -after option. When this
|
---|
681 | is specified, all assignments on the command line after the \c -after
|
---|
682 | option will be postponed until after the specified files are parsed.
|
---|
683 |
|
---|
684 | \target ProjectMode
|
---|
685 | \section2 Project Mode Options
|
---|
686 |
|
---|
687 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 12
|
---|
688 |
|
---|
689 | In project mode, \c qmake will generate a project file. Additionally, you
|
---|
690 | may supply the following options in this mode:
|
---|
691 |
|
---|
692 | \list
|
---|
693 | \o \c -r \BR
|
---|
694 | \c qmake will look through supplied directories recursively
|
---|
695 | \o \c -nopwd \BR
|
---|
696 | \c qmake will not look in your current working directory for
|
---|
697 | source code and only use the specified \c files
|
---|
698 | \endlist
|
---|
699 |
|
---|
700 | In this mode, the \c files argument can be a list of files or directories.
|
---|
701 | If a directory is specified, it will be included in the \c DEPENDPATH
|
---|
702 | variable, and relevant code from there will be included in the generated
|
---|
703 | project file. If a file is given, it will be appended to the correct
|
---|
704 | variable, depending on its extension; for example, .ui files are added
|
---|
705 | to \c FORMS, and .cpp files are added to \c SOURCES.
|
---|
706 |
|
---|
707 | You may also pass assignments on the command line in this mode. When doing
|
---|
708 | so, these assignments will be placed last in the generated project file.
|
---|
709 | */
|
---|
710 |
|
---|
711 | /*!
|
---|
712 | \page qmake-platform-notes.html
|
---|
713 | \title qmake Platform Notes
|
---|
714 | \contentspage {qmake Manual}{Contents}
|
---|
715 | \previouspage Running qmake
|
---|
716 | \nextpage qmake Advanced Usage
|
---|
717 |
|
---|
718 | Many cross-platform projects can be handled by the \c{qmake}'s basic
|
---|
719 | configuration features. On some platforms, it is sometimes useful, or even
|
---|
720 | necessary, to take advantage of platform-specific features. \c qmake knows
|
---|
721 | about many of these features, and these can be accessed via specific
|
---|
722 | variables that only have an effect on the platforms where they are relevant.
|
---|
723 |
|
---|
724 | \tableofcontents
|
---|
725 |
|
---|
726 | \section1 Mac OS X
|
---|
727 |
|
---|
728 | Features specific to this platform include support for creating universal
|
---|
729 | binaries, frameworks and bundles.
|
---|
730 |
|
---|
731 | \section2 Source and Binary Packages
|
---|
732 |
|
---|
733 | The version of \c qmake supplied in source packages is configured slightly
|
---|
734 | differently to that supplied in binary packages in that it uses a different
|
---|
735 | feature specification. Where the source package typically uses the
|
---|
736 | \c macx-g++ specification, the binary package is typically configured to
|
---|
737 | use the \c macx-xcode specification.
|
---|
738 |
|
---|
739 | Users of each package can override this configuration by invoking \c qmake
|
---|
740 | with the \c -spec option (see \l{Running qmake} for more information). This
|
---|
741 | makes it possible, for example, to use \c qmake from a binary package to
|
---|
742 | create a Makefile in a project directory with the following command line
|
---|
743 | invocation:
|
---|
744 |
|
---|
745 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 13
|
---|
746 |
|
---|
747 | \section2 Using Frameworks
|
---|
748 |
|
---|
749 | \c qmake is able to automatically generate build rules for linking against
|
---|
750 | frameworks in the standard framework directory on Mac OS X, located at
|
---|
751 | \c{/Library/Frameworks/}.
|
---|
752 |
|
---|
753 | Directories other than the standard framework directory need to be specified
|
---|
754 | to the build system, and this is achieved by appending linker options to the
|
---|
755 | \l{qmake Variable Reference#QMAKE_LFLAGS}{QMAKE_LFLAGS} variable, as shown
|
---|
756 | in the following example:
|
---|
757 |
|
---|
758 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 14
|
---|
759 |
|
---|
760 | The framework itself is linked in by appending the \c{-framework} options and
|
---|
761 | the name of the framework to the \l{qmake Variable Reference#LIBS}{LIBS}
|
---|
762 | variable:
|
---|
763 |
|
---|
764 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 15
|
---|
765 |
|
---|
766 | \section2 Creating Frameworks
|
---|
767 |
|
---|
768 | Any given library project can be configured so that the resulting library
|
---|
769 | file is placed in a
|
---|
770 | \l{http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WhatAreFrameworks.html}
|
---|
771 | {framework}, ready for deployment. To do this, set up the project to use the
|
---|
772 | \l{qmake Variable Reference#TEMPLATE}{\c lib template} and add the
|
---|
773 | \c lib_bundle option to the
|
---|
774 | \l{qmake Variable Reference#CONFIG}{CONFIG} variable:
|
---|
775 |
|
---|
776 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 16
|
---|
777 |
|
---|
778 | The data associated with the library is specified using the
|
---|
779 | \l{qmake Variable Reference#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA}
|
---|
780 | variable. This holds items that will be installed with a library
|
---|
781 | bundle, and is often used to specify a collection of header files,
|
---|
782 | as in the following example:
|
---|
783 |
|
---|
784 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 17
|
---|
785 |
|
---|
786 | Here, the \c FRAMEWORK_HEADERS variable is a user-defined variable that
|
---|
787 | is used to define the headers required to use a particular framework.
|
---|
788 | Appending it to the \c QMAKE_BUNDLE_DATA variable ensures that the
|
---|
789 | information about these headers are added to the collection of
|
---|
790 | resources that will be installed with the library bundle. Also, the
|
---|
791 | framework's name and version are specified by
|
---|
792 | \l{qmake Variable Reference#QMAKE_FRAMEWORK_BUNDLE_NAME}
|
---|
793 | {QMAKE_FRAMEWORK_BUNDLE_NAME}
|
---|
794 | and \l{qmake Variable Reference#QMAKE_FRAMEWORK_VERSION}
|
---|
795 | {QMAKE_FRAMEWORK_VERSION} variables. By default, the values used for
|
---|
796 | these are obtained from the \l{qmake Variable Reference#TARGET}{TARGET}
|
---|
797 | and \l{qmake Variable Reference#VERSION}{VERSION} variables.
|
---|
798 |
|
---|
799 | See \l{Deploying an Application on Mac OS X} for more information about
|
---|
800 | deploying applications and libraries.
|
---|
801 |
|
---|
802 | \section2 Creating Universal Binaries
|
---|
803 |
|
---|
804 | To create a universal binary for your application, you need to be using
|
---|
805 | a version of Qt that has been configured with the \c{-universal} option.
|
---|
806 |
|
---|
807 | The architectures to be supported in the binary are specified with the
|
---|
808 | \l{qmake Variable Reference#CONFIG}{CONFIG} variable. For example, the
|
---|
809 | following assignment causes \c qmake to generate build rules to create
|
---|
810 | a universal binary for both PowerPC and x86 architectures:
|
---|
811 |
|
---|
812 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 18
|
---|
813 |
|
---|
814 | Additionally, developers using a PowerPC-based platform need to set the
|
---|
815 | \l{qmake Variable Reference#QMAKE_MAC_SDK}{QMAKE_MAC_SDK} variable.
|
---|
816 | This process is discussed in more detail in the
|
---|
817 | \l{Deploying an Application on Mac OS X#Architecture Dependencies}{deployment guide for Mac OS X}.
|
---|
818 |
|
---|
819 | \section2 Creating and Moving Xcode Projects
|
---|
820 |
|
---|
821 | Developers on Mac OS X can take advantage of \c{qmake}'s support for Xcode
|
---|
822 | project files, as described in
|
---|
823 | \l{Qt is Mac OS X Native#Development Tools}{Qt is Mac OS X Native},
|
---|
824 | by running \c qmake to generate an Xcode project from an existing \c qmake
|
---|
825 | project files. For example:
|
---|
826 |
|
---|
827 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 19
|
---|
828 |
|
---|
829 | Note that, if a project is later moved on the disk, \c qmake must be run
|
---|
830 | again to process the project file and create a new Xcode project file.
|
---|
831 |
|
---|
832 | \section1 Windows
|
---|
833 |
|
---|
834 | Features specific to this platform include support for creating Visual
|
---|
835 | Studio project files and handling manifest files when deploying Qt
|
---|
836 | applications developed using Visual Studio 2005.
|
---|
837 |
|
---|
838 | \section2 Creating Visual Studio Project Files
|
---|
839 |
|
---|
840 | Developers using Visual Studio to write Qt applications can use the
|
---|
841 | Visual Studio integration facilities provided with the
|
---|
842 | \l{Qt Commercial Editions} and do not need to worry about how
|
---|
843 | project dependencies are managed.
|
---|
844 |
|
---|
845 | However, some developers may need to import an existing \c qmake project
|
---|
846 | into Visual Studio. \c qmake is able to take a project file and create a
|
---|
847 | Visual Studio project that contains all the necessary information required
|
---|
848 | by the development environment. This is achieved by setting the \c qmake
|
---|
849 | \l{qmake Variable Reference#TEMPLATE}{project template} to either \c vcapp
|
---|
850 | (for application projects) or \c vclib (for library projects).
|
---|
851 |
|
---|
852 | This can also be set using a command line option, for example:
|
---|
853 |
|
---|
854 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 20
|
---|
855 |
|
---|
856 | It is possible to recursively generate \c{.vcproj} files in subdirectories
|
---|
857 | and a \c{.sln} file in the main directory, by typing:
|
---|
858 |
|
---|
859 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 21
|
---|
860 |
|
---|
861 |
|
---|
862 | Each time you update the project file, you need to run \c qmake to generate
|
---|
863 | an updated Visual Studio project.
|
---|
864 |
|
---|
865 | \section2 Visual Studio 2005 Manifest Files
|
---|
866 |
|
---|
867 | When deploying Qt applications built using Visual Studio 2005, it is
|
---|
868 | necessary to ensure that the manifest file, created when the application
|
---|
869 | was linked, is handled correctly. This is handled automatically for
|
---|
870 | projects that generate DLLs.
|
---|
871 |
|
---|
872 | Removing manifest embedding for application executables can be done with
|
---|
873 | the following assignment to the \l{qmake Variable Reference#CONFIG}
|
---|
874 | {CONFIG} variable:
|
---|
875 |
|
---|
876 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 22
|
---|
877 |
|
---|
878 | Also, the manifest embedding for DLLs can be removed with the following
|
---|
879 | assignment to the \l{qmake Variable Reference#CONFIG}{CONFIG} variable:
|
---|
880 |
|
---|
881 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 23
|
---|
882 |
|
---|
883 | This is discussed in more detail in the
|
---|
884 | \l{Deploying an Application on Windows#Visual Studio 2005 Onwards}
|
---|
885 | {deployment guide for Windows}.
|
---|
886 | */
|
---|
887 |
|
---|
888 | /*!
|
---|
889 | \page qmake-reference.html
|
---|
890 | \title qmake Reference
|
---|
891 | \contentspage {qmake Manual}{Contents}
|
---|
892 | \previouspage Using Precompiled Headers
|
---|
893 | \nextpage qmake Variable Reference
|
---|
894 |
|
---|
895 | This reference is a detailed index of all the variables and function
|
---|
896 | that are available for use in \c qmake project files.
|
---|
897 |
|
---|
898 | \section1 Variable Reference
|
---|
899 |
|
---|
900 | The \l{qmake Variable Reference} describes the variables that are
|
---|
901 | recognized by \c qmake when configuring the build process for
|
---|
902 | projects.
|
---|
903 |
|
---|
904 | \section1 Function Reference
|
---|
905 |
|
---|
906 | The \l{qmake Function Reference} describes the function that can be
|
---|
907 | used to process the contents of variables defined in project files.
|
---|
908 |
|
---|
909 | \target FrequentlyUsedVariables
|
---|
910 | \section1 Frequently Used Variables
|
---|
911 |
|
---|
912 | The following variables are frequently used in project files to describe
|
---|
913 | common aspects of the build process. These are fully described in the
|
---|
914 | \l{qmake-variable-reference.html}{Variable Reference}.
|
---|
915 |
|
---|
916 | \list
|
---|
917 | \o \l{qmake Variable Reference#CONFIG}{CONFIG}
|
---|
918 | \o \l{qmake Variable Reference#DEF_FILE}{DEF_FILE}
|
---|
919 | \o \l{qmake Variable Reference#DEFINES}{DEFINES}
|
---|
920 | \o \l{qmake Variable Reference#DESTDIR}{DESTDIR}
|
---|
921 | \o \l{qmake Variable Reference#DISTFILES}{DISTFILES}
|
---|
922 | \o \l{qmake Variable Reference#DLLDESTDIR}{DLLDESTDIR}
|
---|
923 | \o \l{qmake Variable Reference#FORMS}{FORMS}
|
---|
924 | \o \l{qmake Variable Reference#FORMS3}{FORMS3}
|
---|
925 | \o \l{qmake Variable Reference#GUID}{GUID}
|
---|
926 | \o \l{qmake Variable Reference#HEADERS}{HEADERS}
|
---|
927 | \o \l{qmake Variable Reference#INCLUDEPATH}{INCLUDEPATH}
|
---|
928 | \o \l{qmake Variable Reference#LEXSOURCES}{LEXSOURCES}
|
---|
929 | \o \l{qmake Variable Reference#LIBS}{LIBS}
|
---|
930 | \o \l{qmake Variable Reference#MOC_DIR}{MOC_DIR}
|
---|
931 | \o \l{qmake Variable Reference#OBJECTS_DIR}{OBJECTS_DIR}
|
---|
932 | \o \l{qmake Variable Reference#QT}{QT}
|
---|
933 | \o \l{qmake Variable Reference#RCC_DIR}{RCC_DIR}
|
---|
934 | \o \l{qmake Variable Reference#REQUIRES}{REQUIRES}
|
---|
935 | \o \l{qmake Variable Reference#SOURCES}{SOURCES}
|
---|
936 | \o \l{qmake Variable Reference#SUBDIRS}{SUBDIRS}
|
---|
937 | \o \l{qmake Variable Reference#TARGET}{TARGET}
|
---|
938 | \o \l{qmake Variable Reference#TEMPLATE}{TEMPLATE}
|
---|
939 | \o \l{qmake Variable Reference#TRANSLATIONS}{TRANSLATIONS}
|
---|
940 | \o \l{qmake Variable Reference#UI_DIR}{UI_DIR}
|
---|
941 | \o \l{qmake Variable Reference#UI_HEADERS_DIR}{UI_HEADERS_DIR}
|
---|
942 | \o \l{qmake Variable Reference#UI_SOURCES_DIR}{UI_SOURCES_DIR}
|
---|
943 | \o \l{qmake Variable Reference#VERSION}{VERSION}
|
---|
944 | \o \l{qmake Variable Reference#YACCSOURCES}{YACCSOURCES}
|
---|
945 | \endlist
|
---|
946 |
|
---|
947 | \section1 Environment Variables and Configuration
|
---|
948 |
|
---|
949 | The \l{Configuring qmake's Environment} chapter of this manual
|
---|
950 | describes the environment variables that \c qmake uses when
|
---|
951 | configuring the build process.
|
---|
952 | */
|
---|
953 |
|
---|
954 | /*!
|
---|
955 | \page qmake-variable-reference.html
|
---|
956 | \title qmake Variable Reference
|
---|
957 | \contentspage {qmake Manual}{Contents}
|
---|
958 | \previouspage qmake Reference
|
---|
959 | \nextpage qmake Function Reference
|
---|
960 |
|
---|
961 | \c{qmake}'s fundamental behavior is influenced by variable declarations that
|
---|
962 | define the build process of each project. Some of these declare resources,
|
---|
963 | such as headers and source files, that are common to each platform; others
|
---|
964 | are used to customize the behavior of compilers and linkers on specific
|
---|
965 | platforms.
|
---|
966 |
|
---|
967 | Platform-specific variables follow the naming pattern of the
|
---|
968 | variables which they extend or modify, but include the name of the relevant
|
---|
969 | platform in their name. For example, \c QMAKE_LIBS can be used to specify a list
|
---|
970 | of libraries that a project needs to link against, and \c QMAKE_LIBS_X11 can be
|
---|
971 | used to extend or override this list.
|
---|
972 |
|
---|
973 | \tableofcontents{3}
|
---|
974 |
|
---|
975 | \target CONFIG
|
---|
976 | \section1 CONFIG
|
---|
977 |
|
---|
978 | The \c CONFIG variable specifies project configuration and
|
---|
979 | compiler options. The values will be recognized internally by
|
---|
980 | \c qmake and have special meaning. They are as follows.
|
---|
981 |
|
---|
982 | These \c CONFIG values control compilation flags:
|
---|
983 |
|
---|
984 | \table 95%
|
---|
985 | \header \o Option \o Description
|
---|
986 | \row \o release \o The project is to be built in release mode.
|
---|
987 | This is ignored if \c debug is also specified.
|
---|
988 | \row \o debug \o The project is to be built in debug mode.
|
---|
989 | \row \o debug_and_release \o The project is built in \e both debug and
|
---|
990 | release modes. This can have some unexpected side effects (see
|
---|
991 | below for more information).
|
---|
992 | \row \o build_all \o If \c debug_and_release is specified, the project is
|
---|
993 | built in both debug and release modes by default.
|
---|
994 | \row \o ordered \o When using the \c subdirs template, this option
|
---|
995 | specifies that the directories listed should be processed in the
|
---|
996 | order in which they are given.
|
---|
997 | \row \o precompile_header \o Enables support for the use of
|
---|
998 | \l{Using Precompiled Headers}{precompiled headers} in projects.
|
---|
999 | \row \o warn_on \o The compiler should output as many warnings as possible.
|
---|
1000 | This is ignored if \c warn_off is specified.
|
---|
1001 | \row \o warn_off \o The compiler should output as few warnings as possible.
|
---|
1002 | \omit
|
---|
1003 | \row \o qt_debug \o Specifies that the project should be built against
|
---|
1004 | debug versions of the Qt libraries specified using the
|
---|
1005 | \l{#QT}{QT} variable.
|
---|
1006 | \row \o qt_release \o Specifies that the project should be built against
|
---|
1007 | release versions of the Qt libraries specified using the
|
---|
1008 | \l{#QT}{QT} variable.
|
---|
1009 | \endomit
|
---|
1010 | \endtable
|
---|
1011 |
|
---|
1012 | Since the \c debug option overrides the \c release option when both are
|
---|
1013 | defined in the \c CONFIG variable, it is necessary to use the
|
---|
1014 | \c debug_and_release option if you want to allow both debug and release
|
---|
1015 | versions of a project to be built. In such a case, the Makefile that
|
---|
1016 | \c qmake generates includes a rule that builds both versions, and this can
|
---|
1017 | be invoked in the following way:
|
---|
1018 |
|
---|
1019 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 24
|
---|
1020 |
|
---|
1021 | On Windows (or if Qt is configured with \c{-debug_and_release}, adding the
|
---|
1022 | \c build_all option to the \c CONFIG variable makes this rule the default
|
---|
1023 | when building the project, and installation targets will be created for
|
---|
1024 | both debug and release builds.
|
---|
1025 |
|
---|
1026 | Additionally, adding \c debug_and_release to the \c CONFIG variable will
|
---|
1027 | cause both \c debug and \c release to be defined in the contents of
|
---|
1028 | \c CONFIG. When the project file is processed, the
|
---|
1029 | \l{qmake Advanced Usage#Scopes}{scopes} that test for each value will be
|
---|
1030 | processed for \e both debug and release modes. The \c{build_pass} variable
|
---|
1031 | will be set for each of these mode, and you can test for this to perform
|
---|
1032 | build-specific tasks. For example:
|
---|
1033 |
|
---|
1034 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 25
|
---|
1035 |
|
---|
1036 | As a result, it may be useful to define mode-specific variables, such as
|
---|
1037 | \l{#QMAKE_LFLAGS_RELEASE}{QMAKE_LFLAGS_RELEASE}, instead of general
|
---|
1038 | variables, such as \l{#QMAKE_LFLAGS}{QMAKE_LFLAGS}, where possible.
|
---|
1039 |
|
---|
1040 | The following options define the application/library type:
|
---|
1041 |
|
---|
1042 | \table 95%
|
---|
1043 | \header \o Option \o Description
|
---|
1044 | \row \o qt \o The target is a Qt application/library and requires the Qt
|
---|
1045 | library and header files. The proper include and library paths for the
|
---|
1046 | Qt library will automatically be added to the project. This is defined
|
---|
1047 | by default, and can be fine-tuned with the \c{\l{#qt}{QT}} variable.
|
---|
1048 | \row \o thread \o The target is a multi-threaded application or library. The
|
---|
1049 | proper defines and compiler flags will automatically be added to
|
---|
1050 | the project.
|
---|
1051 | \row \o x11 \o The target is a X11 application or library. The proper
|
---|
1052 | include paths and libraries will automatically be added to the
|
---|
1053 | project.
|
---|
1054 | \row \o windows \o The target is a Win32 window application (app only). The
|
---|
1055 | proper include paths, compiler flags and libraries will
|
---|
1056 | automatically be added to the project.
|
---|
1057 | \row \o console \o The target is a Win32 console application (app only). The
|
---|
1058 | proper include paths, compiler flags and libraries will
|
---|
1059 | automatically be added to the
|
---|
1060 | project.
|
---|
1061 | \row \o shared \o{1,3} The target is a shared object/DLL. The proper
|
---|
1062 | include paths, compiler flags and libraries will automatically be
|
---|
1063 | added to the project.
|
---|
1064 | \row \o dll \o
|
---|
1065 | \row \o dylib \o
|
---|
1066 | \row \o static \o{1,2} The target is a static library (lib only). The proper
|
---|
1067 | compiler flags will automatically be added to the project.
|
---|
1068 | \row \o staticlib \o
|
---|
1069 | \row \o plugin \o The target is a plugin (lib only). This enables dll as well.
|
---|
1070 | \row \o designer \o The target is a plugin for \QD.
|
---|
1071 | \row \o uic3 \o Configures qmake to run uic3 on the content of \c FORMS3 if
|
---|
1072 | defined; otherwise the contents of \c FORMS will be processed instead.
|
---|
1073 | \row \o no_lflags_merge \o Ensures that the list of libraries stored in the
|
---|
1074 | \c LIBS variable is not reduced to a list of unique values before it is used.
|
---|
1075 | \row \o resources \o Configures qmake to run rcc on the content of \c RESOURCES
|
---|
1076 | if defined.
|
---|
1077 | \endtable
|
---|
1078 |
|
---|
1079 | These options are used to set the compiler flags:
|
---|
1080 |
|
---|
1081 | \table 95%
|
---|
1082 | \header \o Option \o Description
|
---|
1083 | \row \o 3dnow \o AMD 3DNow! instruction support is enabled.
|
---|
1084 | \row \o exceptions \o Exception support is enabled.
|
---|
1085 | \row \o mmx \o Intel MMX instruction support is enabled.
|
---|
1086 | \row \o rtti \o RTTI support is enabled.
|
---|
1087 | \row \o stl \o STL support is enabled.
|
---|
1088 | \row \o sse \o SSE support is enabled.
|
---|
1089 | \row \o sse2 \o SSE2 support is enabled.
|
---|
1090 | \endtable
|
---|
1091 |
|
---|
1092 | These options define specific features on Windows only:
|
---|
1093 |
|
---|
1094 | \table 95%
|
---|
1095 | \header \o Option \o Description
|
---|
1096 | \row \o flat \o When using the vcapp template this will put all the source
|
---|
1097 | files into the source group and the header files into the header group
|
---|
1098 | regardless of what directory they reside in. Turning this
|
---|
1099 | option off will group the files within the source/header group depending
|
---|
1100 | on the directory they reside. This is turned on by default.
|
---|
1101 | \row \o embed_manifest_dll \o Embeds a manifest file in the DLL created
|
---|
1102 | as part of a library project.
|
---|
1103 | \row \o embed_manifest_exe \o Embeds a manifest file in the DLL created
|
---|
1104 | as part of an application project.
|
---|
1105 | \row \o incremental \o Used to enable or disable incremental linking in Visual
|
---|
1106 | C++, depending on whether this feature is enabled or disabled by default.
|
---|
1107 | \endtable
|
---|
1108 |
|
---|
1109 | See \l{qmake Platform Notes#Visual Studio 2005 Manifest Files}{qmake Platform Notes}
|
---|
1110 | for more information on the options for embedding manifest files.
|
---|
1111 |
|
---|
1112 | These options only have an effect on Mac OS X:
|
---|
1113 |
|
---|
1114 | \table 95%
|
---|
1115 | \header \o Option \o Description
|
---|
1116 | \row \o ppc \o Builds a PowerPC binary.
|
---|
1117 | \row \o x86 \o Builds an i386 compatible binary.
|
---|
1118 | \row \o app_bundle \o Puts the executable into a bundle (this is the default).
|
---|
1119 | \row \o lib_bundle \o Puts the library into a library bundle.
|
---|
1120 | \endtable
|
---|
1121 |
|
---|
1122 | The build process for bundles is also influenced by
|
---|
1123 | the contents of the \l{#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA} variable.
|
---|
1124 |
|
---|
1125 | These options have an effect on Linux/Unix platforms:
|
---|
1126 |
|
---|
1127 | \table 95%
|
---|
1128 | \header \o Option \o Description
|
---|
1129 | \row \o largefile \o Includes support for large files.
|
---|
1130 | \row \o separate_debug_info \o Puts debugging information for libraries in
|
---|
1131 | separate files.
|
---|
1132 | \endtable
|
---|
1133 |
|
---|
1134 | The \c CONFIG variable will also be checked when resolving scopes. You may
|
---|
1135 | assign anything to this variable.
|
---|
1136 |
|
---|
1137 | For example:
|
---|
1138 |
|
---|
1139 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 26
|
---|
1140 |
|
---|
1141 | \target DEFINES
|
---|
1142 | \section1 DEFINES
|
---|
1143 |
|
---|
1144 | \c qmake adds the values of this variable as compiler C
|
---|
1145 | preprocessor macros (-D option).
|
---|
1146 |
|
---|
1147 | For example:
|
---|
1148 |
|
---|
1149 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 27
|
---|
1150 |
|
---|
1151 | \target DEF_FILE
|
---|
1152 | \section1 DEF_FILE
|
---|
1153 |
|
---|
1154 | \e {This is only used on Windows when using the \c app template}.
|
---|
1155 |
|
---|
1156 | Specifies a \c .def file to be included in the project.
|
---|
1157 |
|
---|
1158 | \target DEPENDPATH
|
---|
1159 | \section1 DEPENDPATH
|
---|
1160 |
|
---|
1161 | This variable contains the list of all directories to look in to
|
---|
1162 | resolve dependencies. This will be used when crawling through
|
---|
1163 | \c included files.
|
---|
1164 |
|
---|
1165 | \target DEPLOYMENT
|
---|
1166 | \section1 DEPLOYMENT
|
---|
1167 |
|
---|
1168 | \e {This is only used on Windows CE.}
|
---|
1169 |
|
---|
1170 | Specifies which additional files will be deployed. Deployment means the
|
---|
1171 | transfer of files from the development system to the target device or
|
---|
1172 | emulator.
|
---|
1173 |
|
---|
1174 | Files can be deployed by either creating a Visual Studio project or using
|
---|
1175 | the \l {Using QTestLib remotely on Windows CE}{cetest} executable.
|
---|
1176 |
|
---|
1177 | For example:
|
---|
1178 |
|
---|
1179 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 28
|
---|
1180 |
|
---|
1181 | This will upload all PNG images in \c path to the same directory your
|
---|
1182 | build target will be deployed to.
|
---|
1183 |
|
---|
1184 | The default deployment target path for Windows CE is
|
---|
1185 | \c{%CSIDL_PROGRAM_FILES%\target}, which usually gets expanded to
|
---|
1186 | \c{\Program Files\target}.
|
---|
1187 |
|
---|
1188 | It is also possible to specify multiple \c sources to be deployed on
|
---|
1189 | target \c paths. In addition, different variables can be used for
|
---|
1190 | deployment to different directories.
|
---|
1191 |
|
---|
1192 | For example:
|
---|
1193 |
|
---|
1194 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 29
|
---|
1195 |
|
---|
1196 | \note All linked Qt libraries will be deployed to the path specified
|
---|
1197 | by \c{myFiles.path}.
|
---|
1198 |
|
---|
1199 | \target DEPLOYMENT_PLUGIN
|
---|
1200 | \section1 DEPLOYMENT_PLUGIN
|
---|
1201 |
|
---|
1202 | \e {This is only used on Windows CE.}
|
---|
1203 |
|
---|
1204 | This variable specifies the Qt plugins that will be deployed. All plugins
|
---|
1205 | available in Qt can be explicitly deployed to the device. See
|
---|
1206 | \l{Static Plugins}{Static Plugins} for a complete list.
|
---|
1207 |
|
---|
1208 | \note No plugins will be deployed automatically. If the application
|
---|
1209 | depends on plugins, these plugins have to be specified manually.
|
---|
1210 |
|
---|
1211 | For example:
|
---|
1212 |
|
---|
1213 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 128
|
---|
1214 |
|
---|
1215 | This will upload the jpeg imageformat plugin to the plugins directory
|
---|
1216 | on the Windows CE device.
|
---|
1217 |
|
---|
1218 | \target DESTDIR
|
---|
1219 | \section1 DESTDIR
|
---|
1220 |
|
---|
1221 | Specifies where to put the \l{#TARGET}{target} file.
|
---|
1222 |
|
---|
1223 | For example:
|
---|
1224 |
|
---|
1225 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 30
|
---|
1226 |
|
---|
1227 | \target DESTDIR_TARGET
|
---|
1228 | \section1 DESTDIR_TARGET
|
---|
1229 |
|
---|
1230 | This variable is set internally by \c qmake, which is basically the
|
---|
1231 | \c DESTDIR variable with the \c TARGET variable appened at the end.
|
---|
1232 | The value of this variable is typically handled by \c qmake or
|
---|
1233 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1234 |
|
---|
1235 | \target DLLDESTDIR
|
---|
1236 | \section1 DLLDESTDIR
|
---|
1237 |
|
---|
1238 | Specifies where to copy the \l{#TARGET}{target} dll.
|
---|
1239 |
|
---|
1240 | \target DISTFILES
|
---|
1241 | \section1 DISTFILES
|
---|
1242 |
|
---|
1243 | This variable contains a list of files to be included in the dist
|
---|
1244 | target. This feature is supported by UnixMake specs only.
|
---|
1245 |
|
---|
1246 | For example:
|
---|
1247 |
|
---|
1248 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 31
|
---|
1249 |
|
---|
1250 | \target DSP_TEMPLATE
|
---|
1251 | \section1 DSP_TEMPLATE
|
---|
1252 |
|
---|
1253 | This variable is set internally by \c qmake, which specifies where the
|
---|
1254 | dsp template file for basing generated dsp files is stored. The value
|
---|
1255 | of this variable is typically handled by \c qmake or
|
---|
1256 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1257 |
|
---|
1258 | \target FORMS
|
---|
1259 | \section1 FORMS
|
---|
1260 |
|
---|
1261 | This variable specifies the .ui files (see \link
|
---|
1262 | designer-manual.html Qt Designer \endlink) to be processed through \c uic
|
---|
1263 | before compiling. All dependencies, headers and source files required
|
---|
1264 | to build these .ui files will automatically be added to the project.
|
---|
1265 |
|
---|
1266 | For example:
|
---|
1267 |
|
---|
1268 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 32
|
---|
1269 |
|
---|
1270 | If FORMS3 is defined in your project, then this variable must contain
|
---|
1271 | forms for uic, and not uic3. If CONFIG contains uic3, and FORMS3 is not
|
---|
1272 | defined, the this variable must contain only uic3 type forms.
|
---|
1273 |
|
---|
1274 | \target FORMS3
|
---|
1275 | \section1 FORMS3
|
---|
1276 |
|
---|
1277 | This variable specifies the old style .ui files to be processed
|
---|
1278 | through \c uic3 before compiling, when \c CONFIG contains uic3.
|
---|
1279 | All dependencies, headers and source files required to build these
|
---|
1280 | .ui files will automatically be added to the project.
|
---|
1281 |
|
---|
1282 | For example:
|
---|
1283 |
|
---|
1284 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 33
|
---|
1285 |
|
---|
1286 | \target GUID
|
---|
1287 | \section1 GUID
|
---|
1288 |
|
---|
1289 | Specifies the GUID that is set inside a \c{.vcproj} file. The GUID is
|
---|
1290 | usually randomly determined. However, should you require a fixed GUID,
|
---|
1291 | it can be set using this variable.
|
---|
1292 |
|
---|
1293 | This variable is specific to \c{.vcproj} files only; it is ignored
|
---|
1294 | otherwise.
|
---|
1295 |
|
---|
1296 | \target HEADERS
|
---|
1297 | \section1 HEADERS
|
---|
1298 |
|
---|
1299 | Defines the header files for the project.
|
---|
1300 |
|
---|
1301 | \c qmake will generate dependency information (unless \c -nodepend
|
---|
1302 | is specified on the \l{Running qmake#Commands}{command line})
|
---|
1303 | for the specified headers. \c qmake will also automatically detect if
|
---|
1304 | \c moc is required by the classes in these headers, and add the
|
---|
1305 | appropriate dependencies and files to the project for generating and
|
---|
1306 | linking the moc files.
|
---|
1307 |
|
---|
1308 | For example:
|
---|
1309 |
|
---|
1310 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 34
|
---|
1311 |
|
---|
1312 | See also \l{#SOURCES}{SOURCES}.
|
---|
1313 |
|
---|
1314 | \target INCLUDEPATH
|
---|
1315 | \section1 INCLUDEPATH
|
---|
1316 |
|
---|
1317 | This variable specifies the #include directories which should be
|
---|
1318 | searched when compiling the project. Use ';' or a space as the
|
---|
1319 | directory separator.
|
---|
1320 |
|
---|
1321 | For example:
|
---|
1322 |
|
---|
1323 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 35
|
---|
1324 |
|
---|
1325 | \target INSTALLS
|
---|
1326 | \section1 INSTALLS
|
---|
1327 |
|
---|
1328 | This variable contains a list of resources that will be installed when
|
---|
1329 | \c{make install} or a similar installation procedure is executed. Each
|
---|
1330 | item in the list is typically defined with attributes that provide
|
---|
1331 | information about where it will be installed.
|
---|
1332 |
|
---|
1333 | For example, the following \c{target.path} definition describes where the
|
---|
1334 | build target will be installed, and the \c INSTALLS assignment adds the
|
---|
1335 | build target to the list of existing resources to be installed:
|
---|
1336 |
|
---|
1337 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 36
|
---|
1338 |
|
---|
1339 | \target LEXIMPLS
|
---|
1340 | \section1 LEXIMPLS
|
---|
1341 |
|
---|
1342 | This variable contains a list of lex implementation files. The value
|
---|
1343 | of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
|
---|
1344 | needs to be modified.
|
---|
1345 |
|
---|
1346 | \target LEXOBJECTS
|
---|
1347 | \section1 LEXOBJECTS
|
---|
1348 |
|
---|
1349 | This variable contains the names of intermediate lex object
|
---|
1350 | files.The value of this variable is typically handled by
|
---|
1351 | \c qmake and rarely needs to be modified.
|
---|
1352 |
|
---|
1353 | \target LEXSOURCES
|
---|
1354 | \section1 LEXSOURCES
|
---|
1355 |
|
---|
1356 | This variable contains a list of lex source files. All
|
---|
1357 | dependencies, headers and source files will automatically be added to
|
---|
1358 | the project for building these lex files.
|
---|
1359 |
|
---|
1360 | For example:
|
---|
1361 |
|
---|
1362 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 37
|
---|
1363 |
|
---|
1364 | \target LIBS
|
---|
1365 | \section1 LIBS
|
---|
1366 |
|
---|
1367 | This variable contains a list of libraries to be linked into the project.
|
---|
1368 | You can use the Unix \c -l (library) and -L (library path) flags and qmake
|
---|
1369 | will do the correct thing with these libraries on Windows (namely this
|
---|
1370 | means passing the full path of the library to the linker). The only
|
---|
1371 | limitation to this is the library must exist, for qmake to find which
|
---|
1372 | directory a \c -l lib lives in.
|
---|
1373 |
|
---|
1374 | For example:
|
---|
1375 |
|
---|
1376 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 38
|
---|
1377 |
|
---|
1378 | \bold{Note:} On Windows, specifying libraries with the \c{-l} option,
|
---|
1379 | as in the above example, will cause the library with the highest version
|
---|
1380 | number to be used; for example, \c{libmath2.lib} could potentially be used
|
---|
1381 | instead of \c{libmathlib}. To avoid this ambiguity, we recommend that you
|
---|
1382 | explicitly specify the library to be used by including the \c{.lib}
|
---|
1383 | file name suffix.
|
---|
1384 |
|
---|
1385 | By default, the list of libraries stored in \c LIBS is reduced to a list of
|
---|
1386 | unique names before it is used. To change this behavior, add the
|
---|
1387 | \c no_lflags_merge option to the \c CONFIG variable:
|
---|
1388 |
|
---|
1389 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 39
|
---|
1390 |
|
---|
1391 | \target LITERAL_HASH
|
---|
1392 | \section1 LITERAL_HASH
|
---|
1393 |
|
---|
1394 | This variable is used whenever a literal hash character (\c{#}) is needed in
|
---|
1395 | a variable declaration, perhaps as part of a file name or in a string passed
|
---|
1396 | to some external application.
|
---|
1397 |
|
---|
1398 | For example:
|
---|
1399 |
|
---|
1400 | \snippet doc/src/snippets/qmake/comments.pro 1
|
---|
1401 |
|
---|
1402 | By using \c LITERAL_HASH in this way, the \c # character can be used
|
---|
1403 | to construct a URL for the \c message() function to print to the console.
|
---|
1404 |
|
---|
1405 | \target MAKEFILE
|
---|
1406 | \section1 MAKEFILE
|
---|
1407 |
|
---|
1408 | This variable specifies the name of the Makefile which
|
---|
1409 | \c qmake should use when outputting the dependency information
|
---|
1410 | for building a project. The value of this variable is typically
|
---|
1411 | handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1412 |
|
---|
1413 | \target MAKEFILE_GENERATOR
|
---|
1414 | \section1 MAKEFILE_GENERATOR
|
---|
1415 |
|
---|
1416 | This variable contains the name of the Makefile generator to use
|
---|
1417 | when generating a Makefile. The value of this variable is typically
|
---|
1418 | handled internally by \c qmake and rarely needs to be modified.
|
---|
1419 |
|
---|
1420 | \target MOC_DIR
|
---|
1421 | \section1 MOC_DIR
|
---|
1422 |
|
---|
1423 | This variable specifies the directory where all intermediate moc
|
---|
1424 | files should be placed.
|
---|
1425 |
|
---|
1426 | For example:
|
---|
1427 |
|
---|
1428 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 40
|
---|
1429 |
|
---|
1430 | \target OBJECTS
|
---|
1431 | \section1 OBJECTS
|
---|
1432 |
|
---|
1433 | This variable is generated from the \link #SOURCES SOURCES
|
---|
1434 | \endlink variable. The extension of each source file will have been
|
---|
1435 | replaced by .o (Unix) or .obj (Win32). The value of this variable is
|
---|
1436 | typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
|
---|
1437 | rarely needs to be modified.
|
---|
1438 |
|
---|
1439 | \target OBJECTS_DIR
|
---|
1440 | \section1 OBJECTS_DIR
|
---|
1441 |
|
---|
1442 | This variable specifies the directory where all intermediate
|
---|
1443 | objects should be placed.
|
---|
1444 |
|
---|
1445 | For example:
|
---|
1446 |
|
---|
1447 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 41
|
---|
1448 |
|
---|
1449 | \target OBJMOC
|
---|
1450 | \section1 OBJMOC
|
---|
1451 |
|
---|
1452 | This variable is set by \c qmake if files can be found that
|
---|
1453 | contain the Q_OBJECT macro. \c OBJMOC contains the
|
---|
1454 | name of all intermediate moc object files. The value of this variable
|
---|
1455 | is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
1456 | modified.
|
---|
1457 |
|
---|
1458 | \target POST_TARGETDEPS
|
---|
1459 | \section1 POST_TARGETDEPS
|
---|
1460 |
|
---|
1461 | All libraries that the \l{#TARGET}{target} depends on can be
|
---|
1462 | listed in this variable. Some backends do not support this, these include
|
---|
1463 | MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is supported
|
---|
1464 | internally by these build tools, this is useful for explicitly listing
|
---|
1465 | dependant static libraries.
|
---|
1466 |
|
---|
1467 | This list will go after all builtin (and \link #PRE_TARGETDEPS
|
---|
1468 | $$PRE_TARGETDEPS \endlink) dependencies.
|
---|
1469 |
|
---|
1470 | \target PRE_TARGETDEPS
|
---|
1471 | \section1 PRE_TARGETDEPS
|
---|
1472 |
|
---|
1473 | All libraries that the \l{#TARGET}{target} depends on can be
|
---|
1474 | listed in this variable. Some backends do not support this, these include
|
---|
1475 | MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is supported
|
---|
1476 | internally by these build tools, this is useful for explicitly listing
|
---|
1477 | dependant static libraries.
|
---|
1478 |
|
---|
1479 | This list will go before all builtin dependencies.
|
---|
1480 |
|
---|
1481 | \target PRECOMPILED_HEADER
|
---|
1482 | \section1 PRECOMPILED_HEADER
|
---|
1483 |
|
---|
1484 | This variable indicates the header file for creating a precompiled
|
---|
1485 | header file, to increase the compilation speed of a project.
|
---|
1486 | Precompiled headers are currently only supported on some platforms
|
---|
1487 | (Windows - all MSVC project types, Mac OS X - Xcode, Makefile,
|
---|
1488 | Unix - gcc 3.3 and up).
|
---|
1489 |
|
---|
1490 | On other platforms, this variable has different meaning, as noted
|
---|
1491 | below.
|
---|
1492 |
|
---|
1493 | This variable contains a list of header files that require some
|
---|
1494 | sort of pre-compilation step (such as with moc). The value of this
|
---|
1495 | variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
1496 | modified.
|
---|
1497 |
|
---|
1498 | \target PWD
|
---|
1499 | \section1 PWD
|
---|
1500 |
|
---|
1501 | This variable contains the full path leading to the directory where
|
---|
1502 | the \c qmake project file (project.pro) is located.
|
---|
1503 |
|
---|
1504 | \target OUT_PWD
|
---|
1505 | \section1 OUT_PWD
|
---|
1506 |
|
---|
1507 | This variable contains the full path leading to the directory where
|
---|
1508 | \c qmake places the generated Makefile.
|
---|
1509 |
|
---|
1510 | \target QMAKE_systemvariable
|
---|
1511 | \section1 QMAKE
|
---|
1512 |
|
---|
1513 | This variable contains the name of the \c qmake program
|
---|
1514 | itself and is placed in generated Makefiles. The value of this
|
---|
1515 | variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
1516 | modified.
|
---|
1517 |
|
---|
1518 | \target QMAKESPEC_systemvariable
|
---|
1519 | \section1 QMAKESPEC
|
---|
1520 |
|
---|
1521 | This variable contains the name of the \c qmake
|
---|
1522 | configuration to use when generating Makefiles. The value of this
|
---|
1523 | variable is typically handled by \c qmake and rarely needs to be modified.
|
---|
1524 |
|
---|
1525 | Use the \c{QMAKESPEC} environment variable to override the \c qmake configuration.
|
---|
1526 | Note that, due to the way \c qmake reads project files, setting the \c{QMAKESPEC}
|
---|
1527 | environment variable from within a project file will have no effect.
|
---|
1528 |
|
---|
1529 | \target QMAKE_APP_FLAG
|
---|
1530 | \section1 QMAKE_APP_FLAG
|
---|
1531 |
|
---|
1532 | This variable is empty unless the \c app
|
---|
1533 | \l{#TEMPLATE}{TEMPLATE} is specified. The value of this
|
---|
1534 | variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
1535 | modified. Use the following instead:
|
---|
1536 |
|
---|
1537 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 42
|
---|
1538 |
|
---|
1539 | \target QMAKE_APP_OR_DLL
|
---|
1540 | \section1 QMAKE_APP_OR_DLL
|
---|
1541 |
|
---|
1542 | This variable is empty unless the \c app or \c dll
|
---|
1543 | \l{#TEMPLATE}{TEMPLATE} is specified. The value of this
|
---|
1544 | variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
1545 | modified.
|
---|
1546 |
|
---|
1547 | \target QMAKE_AR_CMD
|
---|
1548 | \section1 QMAKE_AR_CMD
|
---|
1549 |
|
---|
1550 | \e {This is used on Unix platforms only.}
|
---|
1551 |
|
---|
1552 | This variable contains the command for invoking the program which
|
---|
1553 | creates, modifies and extracts archives. The value of this variable is
|
---|
1554 | typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
|
---|
1555 | and rarely needs to be modified.
|
---|
1556 |
|
---|
1557 | \target QMAKE_BUNDLE_DATA
|
---|
1558 | \section1 QMAKE_BUNDLE_DATA
|
---|
1559 |
|
---|
1560 | This variable is used to hold the data that will be installed with a library
|
---|
1561 | bundle, and is often used to specify a collection of header files.
|
---|
1562 |
|
---|
1563 | For example, the following lines add \c path/to/header_one.h
|
---|
1564 | and \c path/to/header_two.h to a group containing information about the
|
---|
1565 | headers supplied with the framework:
|
---|
1566 |
|
---|
1567 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 43
|
---|
1568 |
|
---|
1569 | The last line adds the information about the headers to the collection of
|
---|
1570 | resources that will be installed with the library bundle.
|
---|
1571 |
|
---|
1572 | Library bundles are created when the \c lib_bundle option is added to the
|
---|
1573 | \l{#CONFIG}{CONFIG} variable.
|
---|
1574 |
|
---|
1575 | See \l{qmake Platform Notes#Creating Frameworks}{qmake Platform Notes} for
|
---|
1576 | more information about creating library bundles.
|
---|
1577 |
|
---|
1578 | \e{This is used on Mac OS X only.}
|
---|
1579 |
|
---|
1580 | \section1 QMAKE_BUNDLE_EXTENSION
|
---|
1581 |
|
---|
1582 | This variable defines the extension to be used for library bundles.
|
---|
1583 | This allows frameworks to be created with custom extensions instead of the
|
---|
1584 | standard \c{.framework} directory name extension.
|
---|
1585 |
|
---|
1586 | For example, the following definition will result in a framework with the
|
---|
1587 | \c{.myframework} extension:
|
---|
1588 |
|
---|
1589 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 44
|
---|
1590 |
|
---|
1591 | \e{This is used on Mac OS X only.}
|
---|
1592 |
|
---|
1593 | \section1 QMAKE_CC
|
---|
1594 |
|
---|
1595 | This variable specifies the C compiler that will be used when building
|
---|
1596 | projects containing C source code. Only the file name of the compiler
|
---|
1597 | executable needs to be specified as long as it is on a path contained
|
---|
1598 | in the \c PATH variable when the Makefile is processed.
|
---|
1599 |
|
---|
1600 | \target QMAKE_CFLAGS_DEBUG
|
---|
1601 | \section1 QMAKE_CFLAGS_DEBUG
|
---|
1602 |
|
---|
1603 | This variable contains the flags for the C compiler in debug mode.The value of this variable is
|
---|
1604 | typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
|
---|
1605 | and rarely needs to be modified.
|
---|
1606 |
|
---|
1607 | \target QMAKE_CFLAGS_MT
|
---|
1608 | \section1 QMAKE_CFLAGS_MT
|
---|
1609 |
|
---|
1610 | This variable contains the compiler flags for creating a
|
---|
1611 | multi-threaded application or when the version of Qt that you link
|
---|
1612 | against is a multi-threaded statically linked library. The value of
|
---|
1613 | this variable is typically handled by \c qmake or
|
---|
1614 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1615 |
|
---|
1616 | \target QMAKE_CFLAGS_MT_DBG
|
---|
1617 | \section1 QMAKE_CFLAGS_MT_DBG
|
---|
1618 |
|
---|
1619 | This variable contains the compiler flags for creating a debuggable
|
---|
1620 | multi-threaded application or when the version of Qt that you link
|
---|
1621 | against is a debuggable multi-threaded statically linked library. The
|
---|
1622 | value of this variable is typically handled by \c qmake or
|
---|
1623 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1624 |
|
---|
1625 | \target QMAKE_CFLAGS_MT_DLL
|
---|
1626 | \section1 QMAKE_CFLAGS_MT_DLL
|
---|
1627 |
|
---|
1628 | \e {This is used on Windows only.}
|
---|
1629 |
|
---|
1630 | This variable contains the compiler flags for creating a
|
---|
1631 | multi-threaded dll or when the version of Qt that you link
|
---|
1632 | against is a multi-threaded dll. The value of this variable is typically
|
---|
1633 | handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
|
---|
1634 | rarely needs to be modified.
|
---|
1635 |
|
---|
1636 | \target QMAKE_CFLAGS_MT_DLLDBG
|
---|
1637 | \section1 QMAKE_CFLAGS_MT_DLLDBG
|
---|
1638 |
|
---|
1639 | \e {This is used on Windows only.}
|
---|
1640 |
|
---|
1641 | This variable contains the compiler flags for creating a debuggable
|
---|
1642 | multi-threaded dll or when the version of Qt that you link
|
---|
1643 | against is a debuggable multi-threaded statically linked library.
|
---|
1644 | The value of this variable is typically handled by \c qmake or
|
---|
1645 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1646 |
|
---|
1647 | \target QMAKE_CFLAGS_RELEASE
|
---|
1648 | \section1 QMAKE_CFLAGS_RELEASE
|
---|
1649 |
|
---|
1650 | This variable contains the compiler flags for creating a non-debuggable
|
---|
1651 | application. The value of this variable is typically
|
---|
1652 | handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
|
---|
1653 | rarely needs to be modified.
|
---|
1654 |
|
---|
1655 | \target QMAKE_CFLAGS_SHLIB
|
---|
1656 | \section1 QMAKE_CFLAGS_SHLIB
|
---|
1657 |
|
---|
1658 | \e {This is used on Unix platforms only.}
|
---|
1659 |
|
---|
1660 | This variable contains the compiler flags for creating a shared
|
---|
1661 | library. The value of this variable is typically handled by
|
---|
1662 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1663 | to be modified.
|
---|
1664 |
|
---|
1665 | \target QMAKE_CFLAGS_THREAD
|
---|
1666 | \section1 QMAKE_CFLAGS_THREAD
|
---|
1667 |
|
---|
1668 | This variable contains the compiler flags for creating a multi-threaded
|
---|
1669 | application. The value of this variable is typically handled by
|
---|
1670 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1671 | to be modified.
|
---|
1672 |
|
---|
1673 | \target QMAKE_CFLAGS_WARN_OFF
|
---|
1674 | \section1 QMAKE_CFLAGS_WARN_OFF
|
---|
1675 |
|
---|
1676 | This variable is not empty if the warn_off
|
---|
1677 | \l{#TEMPLATE}{TEMPLATE} option is specified. The value of this
|
---|
1678 | variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
|
---|
1679 | and rarely needs to be modified.
|
---|
1680 |
|
---|
1681 | \target QMAKE_CFLAGS_WARN_ON
|
---|
1682 | \section1 QMAKE_CFLAGS_WARN_ON
|
---|
1683 |
|
---|
1684 | This variable is not empty if the warn_on
|
---|
1685 | \l{#TEMPLATE}{TEMPLATE} option is specified.
|
---|
1686 | The value of this variable is typically handled by
|
---|
1687 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1688 | to be modified.
|
---|
1689 |
|
---|
1690 | \target QMAKE_CLEAN
|
---|
1691 | \section1 QMAKE_CLEAN
|
---|
1692 |
|
---|
1693 | This variable contains any files which are not generated files (such as moc and uic
|
---|
1694 | generated files) and object files that should be removed when using "make clean".
|
---|
1695 |
|
---|
1696 | \section1 QMAKE_CXX
|
---|
1697 |
|
---|
1698 | This variable specifies the C++ compiler that will be used when building
|
---|
1699 | projects containing C++ source code. Only the file name of the compiler
|
---|
1700 | executable needs to be specified as long as it is on a path contained
|
---|
1701 | in the \c PATH variable when the Makefile is processed.
|
---|
1702 |
|
---|
1703 | \section1 QMAKE_CXXFLAGS
|
---|
1704 |
|
---|
1705 | This variable contains the C++ compiler flags that are used when building
|
---|
1706 | a project. The value of this variable is typically handled by \c qmake or
|
---|
1707 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. The flags
|
---|
1708 | specific to debug and release modes can be adjusted by modifying
|
---|
1709 | the \c QMAKE_CXXFLAGS_DEBUG and \c QMAKE_CXXFLAGS_RELEASE variables,
|
---|
1710 | respectively.
|
---|
1711 |
|
---|
1712 | \target QMAKE_CXXFLAGS_DEBUG
|
---|
1713 | \section1 QMAKE_CXXFLAGS_DEBUG
|
---|
1714 |
|
---|
1715 | This variable contains the C++ compiler flags for creating a debuggable
|
---|
1716 | application. The value of this variable is typically handled by
|
---|
1717 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1718 | to be modified.
|
---|
1719 |
|
---|
1720 | \target QMAKE_CXXFLAGS_MT
|
---|
1721 | \section1 QMAKE_CXXFLAGS_MT
|
---|
1722 |
|
---|
1723 | This variable contains the C++ compiler flags for creating a multi-threaded
|
---|
1724 | application. The value of this variable is typically handled by
|
---|
1725 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1726 | to be modified.
|
---|
1727 |
|
---|
1728 | \target QMAKE_CXXFLAGS_MT_DBG
|
---|
1729 | \section1 QMAKE_CXXFLAGS_MT_DBG
|
---|
1730 |
|
---|
1731 | This variable contains the C++ compiler flags for creating a debuggable multi-threaded
|
---|
1732 | application. The value of this variable is typically handled by
|
---|
1733 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1734 | to be modified.
|
---|
1735 |
|
---|
1736 | \target QMAKE_CXXFLAGS_MT_DLL
|
---|
1737 | \section1 QMAKE_CXXFLAGS_MT_DLL
|
---|
1738 |
|
---|
1739 | \c {This is used on Windows only.}
|
---|
1740 |
|
---|
1741 | This variable contains the C++ compiler flags for creating a multi-threaded
|
---|
1742 | dll. The value of this variable is typically handled by
|
---|
1743 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1744 | to be modified.
|
---|
1745 |
|
---|
1746 | \target QMAKE_CXXFLAGS_MT_DLLDBG
|
---|
1747 | \section1 QMAKE_CXXFLAGS_MT_DLLDBG
|
---|
1748 |
|
---|
1749 | \c {This is used on Windows only.}
|
---|
1750 |
|
---|
1751 | This variable contains the C++ compiler flags for creating a multi-threaded debuggable
|
---|
1752 | dll. The value of this variable is typically handled by
|
---|
1753 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1754 | to be modified.
|
---|
1755 |
|
---|
1756 | \target QMAKE_CXXFLAGS_RELEASE
|
---|
1757 | \section1 QMAKE_CXXFLAGS_RELEASE
|
---|
1758 |
|
---|
1759 | This variable contains the C++ compiler flags for creating an
|
---|
1760 | application. The value of this variable is typically handled by
|
---|
1761 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1762 | to be modified.
|
---|
1763 |
|
---|
1764 | \target QMAKE_CXXFLAGS_SHLIB
|
---|
1765 | \section1 QMAKE_CXXFLAGS_SHLIB
|
---|
1766 |
|
---|
1767 | This variable contains the C++ compiler flags for creating a
|
---|
1768 | shared library. The value of this variable is typically handled by
|
---|
1769 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1770 | to be modified.
|
---|
1771 |
|
---|
1772 | \target QMAKE_CXXFLAGS_THREAD
|
---|
1773 | \section1 QMAKE_CXXFLAGS_THREAD
|
---|
1774 |
|
---|
1775 | This variable contains the C++ compiler flags for creating a
|
---|
1776 | multi-threaded application. The value of this variable is typically handled by
|
---|
1777 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
---|
1778 | to be modified.
|
---|
1779 |
|
---|
1780 | \target QMAKE_CXXFLAGS_WARN_OFF
|
---|
1781 | \section1 QMAKE_CXXFLAGS_WARN_OFF
|
---|
1782 |
|
---|
1783 | This variable contains the C++ compiler flags for suppressing compiler warnings.
|
---|
1784 | The value of this variable is typically handled by \c qmake or
|
---|
1785 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1786 |
|
---|
1787 | \target QMAKE_CXXFLAGS_WARN_ON
|
---|
1788 | \section1 QMAKE_CXXFLAGS_WARN_ON
|
---|
1789 |
|
---|
1790 | This variable contains C++ compiler flags for generating compiler warnings.
|
---|
1791 | The value of this variable is typically handled by \c qmake or
|
---|
1792 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1793 |
|
---|
1794 | \target QMAKE_DISTCLEAN
|
---|
1795 | \section1 QMAKE_DISTCLEAN
|
---|
1796 |
|
---|
1797 | This variable removes extra files upon the invocation of \c{make distclean}.
|
---|
1798 |
|
---|
1799 | \target QMAKE_EXTENSION_SHLIB
|
---|
1800 | \section1 QMAKE_EXTENSION_SHLIB
|
---|
1801 |
|
---|
1802 | This variable contains the extention for shared libraries. The value of this
|
---|
1803 | variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
|
---|
1804 | and rarely needs to be modified.
|
---|
1805 |
|
---|
1806 | Note that platform-specific variables that change the extension will override
|
---|
1807 | the contents of this variable.
|
---|
1808 |
|
---|
1809 | \section1 QMAKE_EXT_MOC
|
---|
1810 |
|
---|
1811 | This variable changes the extention used on included moc files.
|
---|
1812 |
|
---|
1813 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions}.
|
---|
1814 |
|
---|
1815 | \section1 QMAKE_EXT_UI
|
---|
1816 |
|
---|
1817 | This variable changes the extention used on /e Designer UI files.
|
---|
1818 |
|
---|
1819 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions}.
|
---|
1820 |
|
---|
1821 | \section1 QMAKE_EXT_PRL
|
---|
1822 |
|
---|
1823 | This variable changes the extention used on created PRL files.
|
---|
1824 |
|
---|
1825 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions},
|
---|
1826 | \l{Configuring qmake's Environment#libdepend}{Library Dependencies}.
|
---|
1827 |
|
---|
1828 | \section1 QMAKE_EXT_LEX
|
---|
1829 |
|
---|
1830 | This variable changes the extention used on files given to lex.
|
---|
1831 |
|
---|
1832 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions},
|
---|
1833 | \l{#LEXSOURCES}{LEXSOURCES}.
|
---|
1834 |
|
---|
1835 | \section1 QMAKE_EXT_YACC
|
---|
1836 | This variable changes the extention used on files given to yacc.
|
---|
1837 |
|
---|
1838 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions},
|
---|
1839 | \l{#YACCSOURCES}{YACCSOURCES}.
|
---|
1840 |
|
---|
1841 | \section1 QMAKE_EXT_OBJ
|
---|
1842 |
|
---|
1843 | This variable changes the extention used on generated object files.
|
---|
1844 |
|
---|
1845 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions}.
|
---|
1846 |
|
---|
1847 | \section1 QMAKE_EXT_CPP
|
---|
1848 |
|
---|
1849 | This variable changes the interpretation of all suffixes in this
|
---|
1850 | list of values as files of type C++ source code.
|
---|
1851 |
|
---|
1852 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions}.
|
---|
1853 |
|
---|
1854 | \section1 QMAKE_EXT_H
|
---|
1855 |
|
---|
1856 | This variable changes the interpretation of all suffixes in this
|
---|
1857 | list of values as files of type C header files.
|
---|
1858 |
|
---|
1859 | See also \l{Configuring qmake's Environment#Extensions}{File Extensions}.
|
---|
1860 |
|
---|
1861 | \section1 QMAKE_EXTRA_COMPILERS
|
---|
1862 |
|
---|
1863 | This variable contains the extra compilers/preprocessors that have been added
|
---|
1864 |
|
---|
1865 | See also \l{Configuring qmake's Environment#Customizing}{Customizing Makefile Output}
|
---|
1866 |
|
---|
1867 | \section1 QMAKE_EXTRA_TARGETS
|
---|
1868 |
|
---|
1869 | This variable contains the extra targets that have been added
|
---|
1870 |
|
---|
1871 | See also \l{Configuring qmake's Environment#Customizing}{Customizing Makefile Output}
|
---|
1872 |
|
---|
1873 | \target QMAKE_FAILED_REQUIREMENTS
|
---|
1874 | \section1 QMAKE_FAILED_REQUIREMENTS
|
---|
1875 |
|
---|
1876 | This variable contains the list of requirements that were failed to be met when
|
---|
1877 | \c qmake was used. For example, the sql module is needed and wasn't compiled into Qt. The
|
---|
1878 | value of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
|
---|
1879 | and rarely needs to be modified.
|
---|
1880 |
|
---|
1881 | \target QMAKE_FILETAGS
|
---|
1882 | \section1 QMAKE_FILETAGS
|
---|
1883 |
|
---|
1884 | This variable contains the file tags needed to be entered into the Makefile, such as SOURCES
|
---|
1885 | and HEADERS. The value of this variable is typically handled by \c qmake or
|
---|
1886 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1887 |
|
---|
1888 | \section1 QMAKE_FRAMEWORK_BUNDLE_NAME
|
---|
1889 |
|
---|
1890 | In a framework project, this variable contains the name to be used for the
|
---|
1891 | framework that is built.
|
---|
1892 |
|
---|
1893 | By default, this variable contains the same value as the \l{#TARGET}{TARGET}
|
---|
1894 | variable.
|
---|
1895 |
|
---|
1896 | See \l{qmake Platform Notes#Creating Frameworks}{qmake Platform Notes} for
|
---|
1897 | more information about creating frameworks and library bundles.
|
---|
1898 |
|
---|
1899 | \e{This is used on Mac OS X only.}
|
---|
1900 |
|
---|
1901 | \target QMAKE_FRAMEWORK_VERSION
|
---|
1902 | \section1 QMAKE_FRAMEWORK_VERSION
|
---|
1903 |
|
---|
1904 | For projects where the build target is a Mac OS X framework, this variable
|
---|
1905 | is used to specify the version number that will be applied to the framework
|
---|
1906 | that is built.
|
---|
1907 |
|
---|
1908 | By default, this variable contains the same value as the \l{#VERSION}{VERSION}
|
---|
1909 | variable.
|
---|
1910 |
|
---|
1911 | See \l{qmake Platform Notes#Creating Frameworks}{qmake Platform Notes} for
|
---|
1912 | more information about creating frameworks.
|
---|
1913 |
|
---|
1914 | \e{This is used on Mac OS X only.}
|
---|
1915 |
|
---|
1916 | \target QMAKE_INCDIR
|
---|
1917 | \section1 QMAKE_INCDIR
|
---|
1918 |
|
---|
1919 | This variable contains the location of all known header files to be added to
|
---|
1920 | INCLUDEPATH when building an application. The value of this variable is
|
---|
1921 | typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
|
---|
1922 | needs to be modified.
|
---|
1923 |
|
---|
1924 | \target QMAKE_INCDIR_OPENGL
|
---|
1925 | \section1 QMAKE_INCDIR_OPENGL
|
---|
1926 |
|
---|
1927 | This variable contains the location of OpenGL header files to be added
|
---|
1928 | to INCLUDEPATH when building an application with OpenGL support. The
|
---|
1929 | value of this variable is typically handled by \c qmake or
|
---|
1930 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1931 |
|
---|
1932 | \target QMAKE_INCDIR_QT
|
---|
1933 | \section1 QMAKE_INCDIR_QT
|
---|
1934 |
|
---|
1935 | This variable contains the location of all known header file
|
---|
1936 | paths to be added to INCLUDEPATH when building a Qt application. The value
|
---|
1937 | of this variable is typically handled by \c qmake or
|
---|
1938 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1939 |
|
---|
1940 | \target QMAKE_INCDIR_THREAD
|
---|
1941 | \section1 QMAKE_INCDIR_THREAD
|
---|
1942 |
|
---|
1943 | This variable contains the location of all known header file
|
---|
1944 | paths to be added to INCLUDEPATH when building a multi-threaded application.
|
---|
1945 | The value of this variable is typically handled by \c qmake or
|
---|
1946 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1947 |
|
---|
1948 | \target QMAKE_INCDIR_X11
|
---|
1949 | \section1 QMAKE_INCDIR_X11
|
---|
1950 |
|
---|
1951 | \e {This is used on Unix platforms only.}
|
---|
1952 |
|
---|
1953 | This variable contains the location of X11 header file paths to be
|
---|
1954 | added to INCLUDEPATH when building a X11 application. The
|
---|
1955 | value of this variable is typically handled by \c qmake or
|
---|
1956 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1957 |
|
---|
1958 | \target QMAKE_INFO_PLIST
|
---|
1959 | \section1 QMAKE_INFO_PLIST
|
---|
1960 |
|
---|
1961 | \e {This is used on Mac OS X platforms only.}
|
---|
1962 |
|
---|
1963 | This variable contains the name of the property list file, \c{.plist}, you
|
---|
1964 | would like to include in your Mac OS X application bundle.
|
---|
1965 |
|
---|
1966 | In the \c{.plist} file, you can define some variables, e.g., @EXECUTABLE@,
|
---|
1967 | which qmake will replace with the actual executable name. Other variables
|
---|
1968 | include @ICON@, @TYPEINFO@, @LIBRARY@, and @SHORT_VERSION@.
|
---|
1969 |
|
---|
1970 | \note Most of the time, the default \c{Info.plist} is good enough.
|
---|
1971 |
|
---|
1972 | \section1 QMAKE_LFLAGS
|
---|
1973 |
|
---|
1974 | This variable contains a general set of flags that are passed to
|
---|
1975 | the linker. If you need to change the flags used for a particular
|
---|
1976 | platform or type of project, use one of the specialized variables
|
---|
1977 | for that purpose instead of this variable.
|
---|
1978 |
|
---|
1979 | \target QMAKE_LFLAGS_CONSOLE
|
---|
1980 | \section1 QMAKE_LFLAGS_CONSOLE
|
---|
1981 |
|
---|
1982 | \e {This is used on Windows only.}
|
---|
1983 |
|
---|
1984 | This variable contains link flags when building console
|
---|
1985 | programs. The value of this variable is typically handled by
|
---|
1986 | \c qmake or
|
---|
1987 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1988 |
|
---|
1989 | \section1 QMAKE_LFLAGS_CONSOLE_DLL
|
---|
1990 |
|
---|
1991 | \e {This is used on Windows only.}
|
---|
1992 |
|
---|
1993 | This variable contains link flags when building console
|
---|
1994 | dlls. The value of this variable is typically handled by
|
---|
1995 | \c qmake or
|
---|
1996 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
1997 |
|
---|
1998 | \section1 QMAKE_LFLAGS_DEBUG
|
---|
1999 |
|
---|
2000 | This variable contains link flags when building debuggable applications. The
|
---|
2001 | value of this variable is typically handled by \c qmake or
|
---|
2002 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2003 |
|
---|
2004 | \section1 QMAKE_LFLAGS_PLUGIN
|
---|
2005 |
|
---|
2006 | This variable contains link flags when building plugins. The value
|
---|
2007 | of this variable is typically handled by \c qmake or
|
---|
2008 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2009 |
|
---|
2010 | \section1 QMAKE_LFLAGS_QT_DLL
|
---|
2011 |
|
---|
2012 | This variable contains link flags when building programs that
|
---|
2013 | use the Qt library built as a dll. The value of this variable is
|
---|
2014 | typically handled by \c qmake or
|
---|
2015 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2016 |
|
---|
2017 | \section1 QMAKE_LFLAGS_RELEASE
|
---|
2018 |
|
---|
2019 | This variable contains link flags when building applications for
|
---|
2020 | release. The value of this variable is typically handled by
|
---|
2021 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2022 |
|
---|
2023 | \section1 QMAKE_LFLAGS_SHAPP
|
---|
2024 |
|
---|
2025 | This variable contains link flags when building applications which are using
|
---|
2026 | the \c app template. The value of this variable is typically handled by
|
---|
2027 | \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2028 |
|
---|
2029 | \section1 QMAKE_LFLAGS_SHLIB
|
---|
2030 |
|
---|
2031 | This variable contains link flags when building shared libraries
|
---|
2032 | The value of this variable is typically handled by \c qmake or
|
---|
2033 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2034 |
|
---|
2035 | \section1 QMAKE_LFLAGS_SONAME
|
---|
2036 |
|
---|
2037 | This variable specifies the link flags to set the name of shared objects,
|
---|
2038 | such as .so or .dll. The value of this variable is typically handled by \c
|
---|
2039 | qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2040 |
|
---|
2041 | \section1 QMAKE_LFLAGS_THREAD
|
---|
2042 |
|
---|
2043 | This variable contains link flags when building multi-threaded projects.
|
---|
2044 | The value of this variable is typically handled by \c qmake or
|
---|
2045 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2046 |
|
---|
2047 | \section1 QMAKE_LFLAGS_WINDOWS
|
---|
2048 |
|
---|
2049 | \e {This is used on Windows only.}
|
---|
2050 |
|
---|
2051 | This variable contains link flags when building Windows GUI projects
|
---|
2052 | (i.e. non-console applications).
|
---|
2053 | The value of this variable is typically handled by \c qmake or
|
---|
2054 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2055 |
|
---|
2056 | \section1 QMAKE_LFLAGS_WINDOWS_DLL
|
---|
2057 |
|
---|
2058 | \e {This is used on Windows only.}
|
---|
2059 |
|
---|
2060 | This variable contains link flags when building Windows DLL projects.
|
---|
2061 | The value of this variable is typically handled by \c qmake or
|
---|
2062 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2063 |
|
---|
2064 | \section1 QMAKE_LIBDIR
|
---|
2065 |
|
---|
2066 | This variable contains the location of all known library
|
---|
2067 | directories.The value of this variable is typically handled by
|
---|
2068 | \c qmake or
|
---|
2069 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2070 |
|
---|
2071 | \section1 QMAKE_LIBDIR_FLAGS
|
---|
2072 |
|
---|
2073 | \e {This is used on Unix platforms only.}
|
---|
2074 |
|
---|
2075 | This variable contains the location of all library
|
---|
2076 | directory with -L prefixed. The value of this variable is typically handled by
|
---|
2077 | \c qmake or
|
---|
2078 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2079 |
|
---|
2080 | \section1 QMAKE_LIBDIR_OPENGL
|
---|
2081 |
|
---|
2082 | This variable contains the location of the OpenGL library
|
---|
2083 | directory.The value of this variable is typically handled by
|
---|
2084 | \c qmake or
|
---|
2085 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2086 |
|
---|
2087 | \section1 QMAKE_LIBDIR_QT
|
---|
2088 |
|
---|
2089 | This variable contains the location of the Qt library
|
---|
2090 | directory.The value of this variable is typically handled by
|
---|
2091 | \c qmake or
|
---|
2092 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2093 |
|
---|
2094 | \section1 QMAKE_LIBDIR_X11
|
---|
2095 |
|
---|
2096 | \e {This is used on Unix platforms only.}
|
---|
2097 |
|
---|
2098 | This variable contains the location of the X11 library
|
---|
2099 | directory.The value of this variable is typically handled by
|
---|
2100 | \c qmake or
|
---|
2101 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2102 |
|
---|
2103 | \section1 QMAKE_LIBS
|
---|
2104 |
|
---|
2105 | This variable contains all project libraries. The value of this
|
---|
2106 | variable is typically handled by \c qmake or
|
---|
2107 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2108 |
|
---|
2109 | \section1 QMAKE_LIBS_CONSOLE
|
---|
2110 |
|
---|
2111 | \e {This Windows-specific variable is no longer used.}
|
---|
2112 |
|
---|
2113 | Prior to Qt 4.2, this variable was used to list the libraries
|
---|
2114 | that should be linked against when building a console application
|
---|
2115 | project on Windows. \l{#QMAKE_LIBS_WINDOW}{QMAKE_LIBS_WINDOW}
|
---|
2116 | should now be used instead.
|
---|
2117 |
|
---|
2118 | \section1 QMAKE_LIBS_OPENGL
|
---|
2119 |
|
---|
2120 | This variable contains all OpenGL libraries. The value of this
|
---|
2121 | variable is typically handled by \c qmake or
|
---|
2122 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2123 |
|
---|
2124 | \section1 QMAKE_LIBS_OPENGL_QT
|
---|
2125 |
|
---|
2126 | This variable contains all OpenGL Qt libraries.The value of this
|
---|
2127 | variable is typically handled by \c qmake or
|
---|
2128 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2129 |
|
---|
2130 | \section1 QMAKE_LIBS_QT
|
---|
2131 |
|
---|
2132 | This variable contains all Qt libraries.The value of this
|
---|
2133 | variable is typically handled by \c qmake or
|
---|
2134 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2135 |
|
---|
2136 | \section1 QMAKE_LIBS_QT_DLL
|
---|
2137 |
|
---|
2138 | \e {This is used on Windows only.}
|
---|
2139 |
|
---|
2140 | This variable contains all Qt libraries when Qt is built as a dll. The
|
---|
2141 | value of this variable is typically handled by \c qmake or
|
---|
2142 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2143 |
|
---|
2144 | \section1 QMAKE_LIBS_QT_OPENGL
|
---|
2145 |
|
---|
2146 | This variable contains all the libraries needed to link against if
|
---|
2147 | OpenGL support is turned on. The
|
---|
2148 | value of this variable is typically handled by \c qmake or
|
---|
2149 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2150 |
|
---|
2151 | \section1 QMAKE_LIBS_QT_THREAD
|
---|
2152 |
|
---|
2153 | This variable contains all the libraries needed to link against if
|
---|
2154 | thread support is turned on. The
|
---|
2155 | value of this variable is typically handled by \c qmake or
|
---|
2156 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2157 |
|
---|
2158 | \section1 QMAKE_LIBS_RT
|
---|
2159 |
|
---|
2160 | \e {This is used with Borland compilers only.}
|
---|
2161 |
|
---|
2162 | This variable contains the runtime library needed to link against when
|
---|
2163 | building an application. The
|
---|
2164 | value of this variable is typically handled by \c qmake or
|
---|
2165 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2166 |
|
---|
2167 | \section1 QMAKE_LIBS_RTMT
|
---|
2168 |
|
---|
2169 | \e {This is used with Borland compilers only.}
|
---|
2170 |
|
---|
2171 | This variable contains the runtime library needed to link against when
|
---|
2172 | building a multi-threaded application. The
|
---|
2173 | value of this variable is typically handled by \c qmake or
|
---|
2174 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2175 |
|
---|
2176 | \section1 QMAKE_LIBS_THREAD
|
---|
2177 |
|
---|
2178 | \e {This is used on Unix platforms only.}
|
---|
2179 |
|
---|
2180 | This variable contains all libraries that need to be linked against
|
---|
2181 | when building a multi-threaded application. The
|
---|
2182 | value of this variable is typically handled by \c qmake or
|
---|
2183 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2184 |
|
---|
2185 | \section1 QMAKE_LIBS_WINDOWS
|
---|
2186 |
|
---|
2187 | \e {This is used on Windows only.}
|
---|
2188 |
|
---|
2189 | This variable contains all windows libraries.The value of this
|
---|
2190 | variable is typically handled by \c qmake or
|
---|
2191 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2192 |
|
---|
2193 | \section1 QMAKE_LIBS_X11
|
---|
2194 |
|
---|
2195 | \e {This is used on Unix platforms only.}
|
---|
2196 |
|
---|
2197 | This variable contains all X11 libraries.The value of this
|
---|
2198 | variable is typically handled by \c qmake or
|
---|
2199 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2200 |
|
---|
2201 | \section1 QMAKE_LIBS_X11SM
|
---|
2202 |
|
---|
2203 | \e {This is used on Unix platforms only.}
|
---|
2204 |
|
---|
2205 | This variable contains all X11 session management libraries. The
|
---|
2206 | value of this variable is typically handled by \c qmake or
|
---|
2207 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2208 |
|
---|
2209 | \section1 QMAKE_LIB_FLAG
|
---|
2210 |
|
---|
2211 | This variable is not empty if the \c lib template is specified. The
|
---|
2212 | value of this variable is typically handled by \c qmake or
|
---|
2213 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2214 |
|
---|
2215 | \section1 QMAKE_LINK_SHLIB_CMD
|
---|
2216 |
|
---|
2217 | This variable contains the command to execute when creating a
|
---|
2218 | shared library. The
|
---|
2219 | value of this variable is typically handled by \c qmake or
|
---|
2220 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2221 |
|
---|
2222 | \section1 QMAKE_POST_LINK
|
---|
2223 |
|
---|
2224 | This variable contains the command to execute after linking the TARGET
|
---|
2225 | together. This variable is normally empty and therefore nothing is
|
---|
2226 | executed, additionally some backends will not support this - mostly only
|
---|
2227 | Makefile backends.
|
---|
2228 |
|
---|
2229 | \section1 QMAKE_PRE_LINK
|
---|
2230 |
|
---|
2231 | This variable contains the command to execute before linking the TARGET
|
---|
2232 | together. This variable is normally empty and therefore nothing is
|
---|
2233 | executed, additionally some backends will not support this - mostly only
|
---|
2234 | Makefile backends.
|
---|
2235 |
|
---|
2236 | \section1 QMAKE_LN_SHLIB
|
---|
2237 |
|
---|
2238 | This variable contains the command to execute when creating a link
|
---|
2239 | to a shared library. The
|
---|
2240 | value of this variable is typically handled by \c qmake or
|
---|
2241 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2242 |
|
---|
2243 | \section1 QMAKE_MAC_SDK
|
---|
2244 |
|
---|
2245 | This variable is used on Mac OS X when building universal binaries.
|
---|
2246 | This process is described in more detail in the
|
---|
2247 | \l{Deploying an Application on Mac OS X#Architecture Dependencies}{Deploying
|
---|
2248 | an Application on Mac OS X} document.
|
---|
2249 |
|
---|
2250 | \section1 QMAKE_MACOSX_DEPLOYMENT_TARGET
|
---|
2251 | This variable only has an effect when building on Mac OS X. On that
|
---|
2252 | platform, the variable will be forwarded to the MACOSX_DEPLOYMENT_TARGET
|
---|
2253 | environment variable, which is interpreted by the compiler or linker.
|
---|
2254 | For more information, see the
|
---|
2255 | \l{Deploying an Application on Mac OS X#Mac OS X Version Dependencies}{Deploying
|
---|
2256 | an Application on Mac OS X} document.
|
---|
2257 |
|
---|
2258 | \section1 QMAKE_MAKEFILE
|
---|
2259 |
|
---|
2260 | This variable contains the name of the Makefile to create. The
|
---|
2261 | value of this variable is typically handled by \c qmake or
|
---|
2262 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2263 |
|
---|
2264 | \section1 QMAKE_MOC_SRC
|
---|
2265 |
|
---|
2266 | This variable contains the names of all moc source files to
|
---|
2267 | generate and include in the project. The value of this variable is
|
---|
2268 | typically handled by \c qmake or
|
---|
2269 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2270 |
|
---|
2271 | \section1 QMAKE_QMAKE
|
---|
2272 |
|
---|
2273 | This variable contains the location of qmake if it is not in the path.
|
---|
2274 | The value of this variable is typically handled by \c qmake or
|
---|
2275 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2276 |
|
---|
2277 | \section1 QMAKE_QT_DLL
|
---|
2278 |
|
---|
2279 | This variable is not empty if Qt was built as a dll. The
|
---|
2280 | value of this variable is typically handled by \c qmake or
|
---|
2281 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2282 |
|
---|
2283 | \section1 QMAKE_RESOURCE_FLAGS
|
---|
2284 |
|
---|
2285 | This variable is used to customize the list of options passed to the
|
---|
2286 | \l{rcc}{Resource Compiler} in each of the build rules where it is used.
|
---|
2287 | For example, the following line ensures that the \c{-threshold} and
|
---|
2288 | \c{-compress} options are used with particular values each time that
|
---|
2289 | \c rcc is invoked:
|
---|
2290 |
|
---|
2291 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45
|
---|
2292 |
|
---|
2293 | \section1 QMAKE_RUN_CC
|
---|
2294 |
|
---|
2295 | This variable specifies the individual rule needed to build an object.
|
---|
2296 | The value of this variable is typically handled by \c qmake or
|
---|
2297 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2298 |
|
---|
2299 | \section1 QMAKE_RUN_CC_IMP
|
---|
2300 |
|
---|
2301 | This variable specifies the individual rule needed to build an object.
|
---|
2302 | The value of this variable is typically handled by \c qmake or
|
---|
2303 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2304 |
|
---|
2305 | \section1 QMAKE_RUN_CXX
|
---|
2306 |
|
---|
2307 | This variable specifies the individual rule needed to build an object.
|
---|
2308 | The value of this variable is typically handled by \c qmake or
|
---|
2309 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2310 |
|
---|
2311 | \section1 QMAKE_RUN_CXX_IMP
|
---|
2312 |
|
---|
2313 | This variable specifies the individual rule needed to build an object.
|
---|
2314 | The value of this variable is typically handled by \c qmake or
|
---|
2315 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2316 |
|
---|
2317 | \section1 QMAKE_TARGET
|
---|
2318 |
|
---|
2319 | This variable contains the name of the project target. The value of
|
---|
2320 | this variable is typically handled by \c qmake or
|
---|
2321 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2322 |
|
---|
2323 | \section1 QMAKE_UIC
|
---|
2324 |
|
---|
2325 | This variable contains the location of uic if it is not in the path.
|
---|
2326 | The value of this variable is typically handled by \c qmake or
|
---|
2327 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2328 |
|
---|
2329 | It can be used to specify arguments to uic as well, such as additional plugin
|
---|
2330 | paths. For example:
|
---|
2331 |
|
---|
2332 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 46
|
---|
2333 |
|
---|
2334 | \section1 QT
|
---|
2335 |
|
---|
2336 | The values stored in the \c QT variable control which of the Qt modules are
|
---|
2337 | used by your project.
|
---|
2338 |
|
---|
2339 | The table below shows the options that can be used with the \c QT variable
|
---|
2340 | and the features that are associated with each of them:
|
---|
2341 |
|
---|
2342 | \table
|
---|
2343 | \header \o Option \o Features
|
---|
2344 | \row \o core (included by default) \o QtCore module
|
---|
2345 | \row \o gui (included by default) \o QtGui module
|
---|
2346 | \row \o network \o QtNetwork module
|
---|
2347 | \row \o opengl \o QtOpenGL module
|
---|
2348 | \row \o phonon \o Phonon Multimedia Framework
|
---|
2349 | \row \o sql \o QtSql module
|
---|
2350 | \row \o svg \o QtSvg module
|
---|
2351 | \row \o xml \o QtXml module
|
---|
2352 | \row \o webkit \o WebKit integration
|
---|
2353 | \row \o qt3support \o Qt3Support module
|
---|
2354 | \endtable
|
---|
2355 |
|
---|
2356 | By default, \c QT contains both \c core and \c gui, ensuring that standard
|
---|
2357 | GUI applications can be built without further configuration.
|
---|
2358 |
|
---|
2359 | If you want to build a project \e without the QtGui module, you need to
|
---|
2360 | exclude the \c gui value with the "-=" operator; the following line will
|
---|
2361 | result in a minimal Qt project being built:
|
---|
2362 |
|
---|
2363 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 47
|
---|
2364 |
|
---|
2365 | Note that adding the \c opengl option to the \c QT variable automatically
|
---|
2366 | causes the equivalent option to be added to the \c CONFIG variable.
|
---|
2367 | Therefore, for Qt applications, it is not necessary to add the \c opengl
|
---|
2368 | option to both \c CONFIG and \c{QT}.
|
---|
2369 |
|
---|
2370 | \section1 QTPLUGIN
|
---|
2371 |
|
---|
2372 | This variable contains a list of names of static plugins that are to be
|
---|
2373 | compiled with an application so that they are available as built-in
|
---|
2374 | resources.
|
---|
2375 |
|
---|
2376 | \target QT_VERSION
|
---|
2377 | \section1 QT_VERSION
|
---|
2378 |
|
---|
2379 | This variable contains the current version of Qt.
|
---|
2380 |
|
---|
2381 | \target QT_MAJOR_VERSION
|
---|
2382 | \section1 QT_MAJOR_VERSION
|
---|
2383 |
|
---|
2384 | This variable contains the current major version of Qt.
|
---|
2385 |
|
---|
2386 | \target QT_MINOR_VERSION
|
---|
2387 | \section1 QT_MINOR_VERSION
|
---|
2388 |
|
---|
2389 | This variable contains the current minor version of Qt.
|
---|
2390 |
|
---|
2391 | \target QT_PATCH_VERSION
|
---|
2392 | \section1 QT_PATCH_VERSION
|
---|
2393 |
|
---|
2394 | This variable contains the current patch version of Qt.
|
---|
2395 |
|
---|
2396 | \section1 RC_FILE
|
---|
2397 |
|
---|
2398 | This variable contains the name of the resource file for the application.
|
---|
2399 | The value of this variable is typically handled by \c qmake or
|
---|
2400 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2401 |
|
---|
2402 | \target RCC_DIR
|
---|
2403 | \section1 RCC_DIR
|
---|
2404 |
|
---|
2405 | This variable specifies the directory where all intermediate
|
---|
2406 | resource files should be placed.
|
---|
2407 |
|
---|
2408 | For example:
|
---|
2409 |
|
---|
2410 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 48
|
---|
2411 |
|
---|
2412 | \target REQUIRES
|
---|
2413 | \section1 REQUIRES
|
---|
2414 |
|
---|
2415 | This is a special variable processed by \c qmake. If the
|
---|
2416 | contents of this variable do not appear in CONFIG by the time this
|
---|
2417 | variable is assigned, then a minimal Makefile will be generated that
|
---|
2418 | states what dependencies (the values assigned to REQUIRES) are
|
---|
2419 | missing.
|
---|
2420 |
|
---|
2421 | This is mainly used in Qt's build system for building the examples.
|
---|
2422 |
|
---|
2423 | \section1 RES_FILE
|
---|
2424 |
|
---|
2425 | This variable contains the name of the resource file for the application.
|
---|
2426 | The value of this variable is typically handled by \c qmake or
|
---|
2427 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2428 |
|
---|
2429 | \target SIGNATURE_FILE
|
---|
2430 | \section1 SIGNATURE_FILE
|
---|
2431 |
|
---|
2432 | \e {This is only used on Windows CE.}
|
---|
2433 |
|
---|
2434 | Specifies which signature file should be used to sign the project target.
|
---|
2435 |
|
---|
2436 | \note This variable will overwrite the setting you have specified in configure,
|
---|
2437 | with the \c -signature option.
|
---|
2438 |
|
---|
2439 | \target SOURCES
|
---|
2440 | \section1 SOURCES
|
---|
2441 |
|
---|
2442 | This variable contains the name of all source files in the project.
|
---|
2443 |
|
---|
2444 | For example:
|
---|
2445 |
|
---|
2446 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 49
|
---|
2447 |
|
---|
2448 | See also \l{#HEADERS}{HEADERS}
|
---|
2449 |
|
---|
2450 | \section1 SRCMOC
|
---|
2451 |
|
---|
2452 | This variable is set by \c qmake if files can be found that
|
---|
2453 | contain the Q_OBJECT macro. \c SRCMOC contains the
|
---|
2454 | name of all the generated moc files. The value of this variable
|
---|
2455 | is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
2456 | modified.
|
---|
2457 |
|
---|
2458 | \target SUBDIRS
|
---|
2459 | \section1 SUBDIRS
|
---|
2460 |
|
---|
2461 | This variable, when used with the \l{#TEMPLATE}{\c subdirs template}
|
---|
2462 | contains the names of all subdirectories that contain parts of the project
|
---|
2463 | that need be built. Each subdirectory must contain its own project file.
|
---|
2464 |
|
---|
2465 | For example:
|
---|
2466 |
|
---|
2467 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 50
|
---|
2468 |
|
---|
2469 | It is essential that the project file in each subdirectory has the same
|
---|
2470 | name as the subdirectory itself, so that \c qmake can find it.
|
---|
2471 | For example, if the subdirectory is called \c myapp then the project file
|
---|
2472 | in that directory should be called \c myapp.pro.
|
---|
2473 |
|
---|
2474 | If you need to ensure that the subdirectories are built in the order in
|
---|
2475 | which they are specified, update the \l{#CONFIG}{CONFIG} variable to
|
---|
2476 | include the \c ordered option:
|
---|
2477 |
|
---|
2478 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 51
|
---|
2479 |
|
---|
2480 | \target TARGET
|
---|
2481 | \section1 TARGET
|
---|
2482 |
|
---|
2483 | This specifies the name of the target file.
|
---|
2484 |
|
---|
2485 | For example:
|
---|
2486 |
|
---|
2487 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 52
|
---|
2488 |
|
---|
2489 | The project file above would produce an executable named \c myapp on
|
---|
2490 | unix and 'myapp.exe' on windows.
|
---|
2491 |
|
---|
2492 | \section1 TARGET_EXT
|
---|
2493 |
|
---|
2494 | This variable specifies the target's extension. The value of this variable
|
---|
2495 | is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
2496 | modified.
|
---|
2497 |
|
---|
2498 | \section1 TARGET_x
|
---|
2499 |
|
---|
2500 | This variable specifies the target's extension with a major version number. The value of this variable
|
---|
2501 | is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
2502 | modified.
|
---|
2503 |
|
---|
2504 | \section1 TARGET_x.y.z
|
---|
2505 |
|
---|
2506 | This variable specifies the target's extension with version number. The value of this variable
|
---|
2507 | is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
2508 | modified.
|
---|
2509 |
|
---|
2510 | \target TEMPLATE
|
---|
2511 | \section1 TEMPLATE
|
---|
2512 |
|
---|
2513 | This variable contains the name of the template to use when
|
---|
2514 | generating the project. The allowed values are:
|
---|
2515 |
|
---|
2516 | \table
|
---|
2517 | \header \o Option \o Description
|
---|
2518 | \row \o app \o Creates a Makefile for building applications (the default). (See
|
---|
2519 | \l{qmake Common Projects#Application}{qmake Common Projects} for more information.)
|
---|
2520 | \row \o lib \o Creates a Makefile for building libraries. (See
|
---|
2521 | \l{qmake Common Projects#Library}{qmake Common Projects} for more information.)
|
---|
2522 | \row \o subdirs \o Creates a Makefile for building targets in subdirectories.
|
---|
2523 | The subdirectories are specified using the \l{#SUBDIRS}{SUBDIRS}
|
---|
2524 | variable.
|
---|
2525 | \row \o vcapp \o \e {Windows only} Creates an application project for Visual Studio.
|
---|
2526 | (See \l{qmake Platform Notes#Creating Visual Studio Project Files}{qmake Platform Notes}
|
---|
2527 | for more information.)
|
---|
2528 | \row \o vclib \o \e {Windows only} Creates a library project for Visual Studio.
|
---|
2529 | (See \l{qmake Platform Notes#Creating Visual Studio Project Files}{qmake Platform Notes}
|
---|
2530 | for more information.)
|
---|
2531 | \endtable
|
---|
2532 |
|
---|
2533 | For example:
|
---|
2534 |
|
---|
2535 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 53
|
---|
2536 |
|
---|
2537 | The template can be overridden by specifying a new template type with the
|
---|
2538 | \c -t command line option. This overrides the template type \e after the .pro
|
---|
2539 | file has been processed. With .pro files that use the template type to
|
---|
2540 | determine how the project is built, it is necessary to declare TEMPLATE on
|
---|
2541 | the command line rather than use the \c -t option.
|
---|
2542 |
|
---|
2543 | \section1 TRANSLATIONS
|
---|
2544 |
|
---|
2545 | This variable contains a list of translation (.ts) files that contain
|
---|
2546 | translations of the user interface text into non-native languages.
|
---|
2547 |
|
---|
2548 | See the \l{Qt Linguist Manual} for more information about
|
---|
2549 | internationalization (i18n) and localization (l10n) with Qt.
|
---|
2550 |
|
---|
2551 | \section1 UICIMPLS
|
---|
2552 |
|
---|
2553 | This variable contains a list of the generated implementation files by UIC.
|
---|
2554 | The value of this variable
|
---|
2555 | is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
|
---|
2556 | modified.
|
---|
2557 |
|
---|
2558 | \section1 UICOBJECTS
|
---|
2559 |
|
---|
2560 | This variable is generated from the UICIMPLS variable. The extension of each
|
---|
2561 | file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is
|
---|
2562 | typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
|
---|
2563 | rarely needs to be modified.
|
---|
2564 |
|
---|
2565 | \target UI_DIR
|
---|
2566 | \section1 UI_DIR
|
---|
2567 |
|
---|
2568 | This variable specifies the directory where all intermediate files from uic
|
---|
2569 | should be placed. This variable overrides both UI_SOURCES_DIR and
|
---|
2570 | UI_HEADERS_DIR.
|
---|
2571 |
|
---|
2572 | For example:
|
---|
2573 |
|
---|
2574 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 54
|
---|
2575 |
|
---|
2576 | \target UI_HEADERS_DIR
|
---|
2577 | \section1 UI_HEADERS_DIR
|
---|
2578 |
|
---|
2579 | This variable specifies the directory where all declaration files (as
|
---|
2580 | generated by uic) should be placed.
|
---|
2581 |
|
---|
2582 | For example:
|
---|
2583 |
|
---|
2584 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 55
|
---|
2585 |
|
---|
2586 | \target UI_SOURCES_DIR
|
---|
2587 | \section1 UI_SOURCES_DIR
|
---|
2588 |
|
---|
2589 | This variable specifies the directory where all implementation files (as generated
|
---|
2590 | by uic) should be placed.
|
---|
2591 |
|
---|
2592 | For example:
|
---|
2593 |
|
---|
2594 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 56
|
---|
2595 |
|
---|
2596 | \target VERSION
|
---|
2597 | \section1 VERSION
|
---|
2598 |
|
---|
2599 | This variable contains the version number of the application or library if
|
---|
2600 | either the \c app \l{#TEMPLATE}{TEMPLATE} or the \c lib \l{#TEMPLATE}{TEMPLATE}
|
---|
2601 | is specified.
|
---|
2602 |
|
---|
2603 | For example:
|
---|
2604 |
|
---|
2605 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 57
|
---|
2606 |
|
---|
2607 | \section1 VER_MAJ
|
---|
2608 |
|
---|
2609 | This variable contains the major version number of the library, if the
|
---|
2610 | \c lib \l{#TEMPLATE}{template} is specified.
|
---|
2611 |
|
---|
2612 | \section1 VER_MIN
|
---|
2613 |
|
---|
2614 | This variable contains the minor version number of the library, if the
|
---|
2615 | \c lib \l{#TEMPLATE}{template} is specified.
|
---|
2616 |
|
---|
2617 | \section1 VER_PAT
|
---|
2618 |
|
---|
2619 | This variable contains the patch version number of the library, if the
|
---|
2620 | \c lib \l{#TEMPLATE}{template} is specified.
|
---|
2621 |
|
---|
2622 | \section1 VPATH
|
---|
2623 |
|
---|
2624 | This variable tells \c qmake where to search for files it cannot
|
---|
2625 | open. With this you may tell \c qmake where it may look for things
|
---|
2626 | like SOURCES, and if it finds an entry in SOURCES that cannot be
|
---|
2627 | opened it will look through the entire VPATH list to see if it can
|
---|
2628 | find the file on its own.
|
---|
2629 |
|
---|
2630 | See also \l{#DEPENDPATH}{DEPENDPATH}.
|
---|
2631 |
|
---|
2632 | \section1 YACCIMPLS
|
---|
2633 |
|
---|
2634 | This variable contains a list of yacc source files. The value of
|
---|
2635 | this variable is typically handled by \c qmake or
|
---|
2636 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2637 |
|
---|
2638 | \section1 YACCOBJECTS
|
---|
2639 |
|
---|
2640 | This variable contains a list of yacc object files. The value of
|
---|
2641 | this variable is typically handled by \c qmake or
|
---|
2642 | \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
---|
2643 |
|
---|
2644 | \target YACCSOURCES
|
---|
2645 | \section1 YACCSOURCES
|
---|
2646 |
|
---|
2647 | This variable contains a list of yacc source files to be included
|
---|
2648 | in the project. All dependencies, headers and source files will
|
---|
2649 | automatically be included in the project.
|
---|
2650 |
|
---|
2651 | For example:
|
---|
2652 |
|
---|
2653 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 58
|
---|
2654 |
|
---|
2655 | \section1 _PRO_FILE_
|
---|
2656 |
|
---|
2657 | This variable contains the path to the project file in use.
|
---|
2658 |
|
---|
2659 | For example, the following line causes the location of the project
|
---|
2660 | file to be written to the console:
|
---|
2661 |
|
---|
2662 | \snippet doc/src/snippets/qmake/project_location.pro project file
|
---|
2663 |
|
---|
2664 | \section1 _PRO_FILE_PWD_
|
---|
2665 |
|
---|
2666 | This variable contains the path to the directory containing the project
|
---|
2667 | file in use.
|
---|
2668 |
|
---|
2669 | For example, the following line causes the location of the directory
|
---|
2670 | containing the project file to be written to the console:
|
---|
2671 |
|
---|
2672 | \snippet doc/src/snippets/qmake/project_location.pro project file directory
|
---|
2673 | */
|
---|
2674 |
|
---|
2675 | /*!
|
---|
2676 | \page qmake-function-reference.html
|
---|
2677 | \title qmake Function Reference
|
---|
2678 | \contentspage {qmake Manual}{Contents}
|
---|
2679 | \previouspage qmake Variable Reference
|
---|
2680 | \nextpage Configuring qmake's Environment
|
---|
2681 |
|
---|
2682 | \c qmake provides built-in functions to allow the contents of
|
---|
2683 | variables to be processed, and to enable tests to be performed
|
---|
2684 | during the configuration process. Functions that process the
|
---|
2685 | contents of variables typically return values that can be assigned
|
---|
2686 | to other variables, and these values are obtained by prefixing
|
---|
2687 | function with the \c $$ operator. Functions that perform tests
|
---|
2688 | are usually used as the conditional parts of scopes; these are
|
---|
2689 | indicated in the function descriptions below.
|
---|
2690 |
|
---|
2691 | \tableofcontents{2}
|
---|
2692 |
|
---|
2693 | \section1 basename(variablename)
|
---|
2694 |
|
---|
2695 | Returns the basename of the file specified. For example:
|
---|
2696 |
|
---|
2697 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 59
|
---|
2698 |
|
---|
2699 | \section1 CONFIG(config)
|
---|
2700 | [Conditional]
|
---|
2701 |
|
---|
2702 | This function can be used to test for variables placed into the
|
---|
2703 | \c CONFIG variable. This is the same as regular old style (tmake) scopes,
|
---|
2704 | but has the added advantage a second parameter can be passed to test for
|
---|
2705 | the active config. As the order of values is important in \c CONFIG
|
---|
2706 | variables (i.e. the last one set will be considered the active config for
|
---|
2707 | mutually exclusive values) a second parameter can be used to specify a set
|
---|
2708 | of values to consider. For example:
|
---|
2709 |
|
---|
2710 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 60
|
---|
2711 |
|
---|
2712 | Because release is considered the active setting (for feature parsing)
|
---|
2713 | it will be the CONFIG used to generate the build file. In the common
|
---|
2714 | case a second parameter is not needed, but for specific mutual
|
---|
2715 | exclusive tests it is invaluable.
|
---|
2716 |
|
---|
2717 | \section1 contains(variablename, value)
|
---|
2718 | [Conditional]
|
---|
2719 |
|
---|
2720 | Succeeds if the variable \e variablename contains the value \e value;
|
---|
2721 | otherwise fails. You can check the return value of this function using
|
---|
2722 | a scope.
|
---|
2723 |
|
---|
2724 | For example:
|
---|
2725 |
|
---|
2726 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 61
|
---|
2727 |
|
---|
2728 | The contents of the scope are only processed if the \c drivers
|
---|
2729 | variable contains the value, \c network. If this is the case, the
|
---|
2730 | appropriate files are added to the \c SOURCES and \c HEADERS
|
---|
2731 | variables.
|
---|
2732 |
|
---|
2733 | \section1 count(variablename, number)
|
---|
2734 | [Conditional]
|
---|
2735 |
|
---|
2736 | Succeeds if the variable \e variablename contains a list with the
|
---|
2737 | specified \e number of value; otherwise fails.
|
---|
2738 |
|
---|
2739 | This function is used to ensure that declarations inside a scope are
|
---|
2740 | only processed if the variable contains the correct number of values;
|
---|
2741 | for example:
|
---|
2742 |
|
---|
2743 | \snippet doc/src/snippets/qmake/functions.pro 2
|
---|
2744 |
|
---|
2745 | \section1 dirname(file)
|
---|
2746 |
|
---|
2747 | Returns the directory name part of the specified file. For example:
|
---|
2748 |
|
---|
2749 | \snippet doc/src/snippets/qmake/dirname.pro 0
|
---|
2750 |
|
---|
2751 | \section1 error(string)
|
---|
2752 |
|
---|
2753 | This function never returns a value. \c qmake displays the given
|
---|
2754 | \e string to the user, and exits. This function should only be used
|
---|
2755 | for unrecoverable errors.
|
---|
2756 |
|
---|
2757 | For example:
|
---|
2758 |
|
---|
2759 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 62
|
---|
2760 |
|
---|
2761 | \section1 eval(string)
|
---|
2762 | [Conditional]
|
---|
2763 |
|
---|
2764 | Evaluates the contents of the string using \c qmake's syntax rules
|
---|
2765 | and returns true.
|
---|
2766 | Definitions and assignments can be used in the string to modify the
|
---|
2767 | values of existing variables or create new definitions.
|
---|
2768 |
|
---|
2769 | For example:
|
---|
2770 | \snippet doc/src/snippets/qmake/functions.pro 4
|
---|
2771 |
|
---|
2772 | Note that quotation marks can be used to delimit the string, and that
|
---|
2773 | the return value can be discarded if it is not needed.
|
---|
2774 |
|
---|
2775 | \section1 exists(filename)
|
---|
2776 | [Conditional]
|
---|
2777 |
|
---|
2778 | Tests whether a file with the given \e filename exists.
|
---|
2779 | If the file exists, the function succeeds; otherwise it fails.
|
---|
2780 | If a regular expression is specified for the filename, this function
|
---|
2781 | succeeds if any file matches the regular expression specified.
|
---|
2782 |
|
---|
2783 | For example:
|
---|
2784 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 63
|
---|
2785 |
|
---|
2786 | Note that "/" can be used as a directory separator, regardless of the
|
---|
2787 | platform in use.
|
---|
2788 |
|
---|
2789 | \section1 find(variablename, substr)
|
---|
2790 |
|
---|
2791 | Places all the values in \e variablename that match \e substr. \e
|
---|
2792 | substr may be a regular expression, and will be matched accordingly.
|
---|
2793 |
|
---|
2794 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 64
|
---|
2795 |
|
---|
2796 | MY_VAR2 will contain '-Lone -Ltwo -Lthree -Lfour -Lfive', and MY_VAR3 will
|
---|
2797 | contains 'three two three'.
|
---|
2798 |
|
---|
2799 | \section1 for(iterate, list)
|
---|
2800 |
|
---|
2801 | This special test function will cause a loop to be started that
|
---|
2802 | iterates over all values in \e list, setting \e iterate to each
|
---|
2803 | value in turn. As a convenience, if \e list is 1..10 then iterate will
|
---|
2804 | iterate over the values 1 through 10.
|
---|
2805 |
|
---|
2806 | The use of an else scope afer a condition line with a for() loop is
|
---|
2807 | disallowed.
|
---|
2808 |
|
---|
2809 | For example:
|
---|
2810 |
|
---|
2811 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 65
|
---|
2812 |
|
---|
2813 | \section1 include(filename)
|
---|
2814 | [Conditional]
|
---|
2815 |
|
---|
2816 | Includes the contents of the file specified by \e filename into the
|
---|
2817 | current project at the point where it is included. This function
|
---|
2818 | succeeds if \e filename is included; otherwise it fails. The included
|
---|
2819 | file is processed immediately.
|
---|
2820 |
|
---|
2821 | You can check whether the file was included by using this function as
|
---|
2822 | the condition for a scope; for example:
|
---|
2823 |
|
---|
2824 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 66
|
---|
2825 |
|
---|
2826 | \section1 infile(filename, var, val)
|
---|
2827 | [Conditional]
|
---|
2828 |
|
---|
2829 | Succeeds if the file \e filename (when parsed by \c qmake itself)
|
---|
2830 | contains the variable \e var with a value of \e val; otherwise fails.
|
---|
2831 | If you do not specify a third argument (\e val), the function will
|
---|
2832 | only test whether \e var has been declared in the file.
|
---|
2833 |
|
---|
2834 | \section1 isEmpty(variablename)
|
---|
2835 | [Conditional]
|
---|
2836 |
|
---|
2837 | Succeeds if the variable \e variablename is empty; otherwise fails.
|
---|
2838 | This is the equivalent of \c{count( variablename, 0 )}.
|
---|
2839 |
|
---|
2840 | For example:
|
---|
2841 |
|
---|
2842 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 67
|
---|
2843 |
|
---|
2844 | \section1 join(variablename, glue, before, after)
|
---|
2845 |
|
---|
2846 | Joins the value of \e variablename with \c glue. If this value is
|
---|
2847 | non-empty it prefixes the value with \e before and suffix it with \e
|
---|
2848 | after. \e variablename is the only required field, the others default
|
---|
2849 | to empty strings. If you need to encode spaces in \e glue, \e before, or \e
|
---|
2850 | after you must quote them.
|
---|
2851 |
|
---|
2852 | \section1 member(variablename, position)
|
---|
2853 |
|
---|
2854 | Returns the value at the given \e position in the list of items in
|
---|
2855 | \e variablename.
|
---|
2856 | If an item cannot be found at the position specified, an empty string is
|
---|
2857 | returned. \e variablename is the only required field. If not specified,
|
---|
2858 | \c position defaults to 0, causing the first value in the list to be
|
---|
2859 | returned.
|
---|
2860 |
|
---|
2861 | \section1 message(string)
|
---|
2862 |
|
---|
2863 | This function simply writes a message to the console. Unlike the
|
---|
2864 | \c error() function, this function allows processing to continue.
|
---|
2865 |
|
---|
2866 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 68
|
---|
2867 |
|
---|
2868 | The above line causes "This is a message" to be written to the console.
|
---|
2869 | The use of quotation marks is optional.
|
---|
2870 |
|
---|
2871 | \note By default, messages are written out for each Makefile generated by
|
---|
2872 | qmake for a given project. If you want to ensure that messages only appear
|
---|
2873 | once for each project, test the \c build_pass variable
|
---|
2874 | \l{qmake Advanced Usage}{in conjunction with a scope} to filter out
|
---|
2875 | messages during builds; for example:
|
---|
2876 |
|
---|
2877 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 69
|
---|
2878 |
|
---|
2879 | \section1 prompt(question)
|
---|
2880 |
|
---|
2881 | Displays the specified \e question, and returns a value read from stdin.
|
---|
2882 |
|
---|
2883 | \section1 quote(string)
|
---|
2884 |
|
---|
2885 | Converts a whole \e string into a single entity and returns the result.
|
---|
2886 | Newlines, carriage returns, and tabs can be specified in the string
|
---|
2887 | with \\n \\r and \\t. The return value does not contain either single
|
---|
2888 | or double quotation marks unless you explicitly include them yourself,
|
---|
2889 | but will be placed into a single entry (for literal expansion).
|
---|
2890 |
|
---|
2891 | \section1 replace(string, old_string, new_string)
|
---|
2892 |
|
---|
2893 | Replaces each instance of \c old_string with \c new_string in the
|
---|
2894 | contents of the variable supplied as \c string. For example, the
|
---|
2895 | code
|
---|
2896 |
|
---|
2897 | \snippet doc/src/snippets/qmake/replace.pro 0
|
---|
2898 |
|
---|
2899 | prints the message:
|
---|
2900 |
|
---|
2901 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 70
|
---|
2902 |
|
---|
2903 | \section1 sprintf(string, arguments...)
|
---|
2904 |
|
---|
2905 | Replaces %1-%9 with the arguments passed in the comma-separated list
|
---|
2906 | of function \e arguments and returns the processed string.
|
---|
2907 |
|
---|
2908 | \section1 system(command)
|
---|
2909 | [Conditional]
|
---|
2910 |
|
---|
2911 | Executes the given \c command in a secondary shell, and succeeds
|
---|
2912 | if the command returns with a zero exit status; otherwise fails.
|
---|
2913 | You can check the return value of this function using a scope:
|
---|
2914 |
|
---|
2915 | For example:
|
---|
2916 |
|
---|
2917 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 71
|
---|
2918 |
|
---|
2919 | Alternatively, you can use this function to obtain stdout and stderr
|
---|
2920 | from the command, and assign it to a variable. For example, you can
|
---|
2921 | use this to interrogate information about the platform:
|
---|
2922 |
|
---|
2923 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 72
|
---|
2924 |
|
---|
2925 | \target unique
|
---|
2926 | \section1 unique(variablename)
|
---|
2927 |
|
---|
2928 | This will return a list of values in variable that are unique (that is
|
---|
2929 | with repetitive entries removed). For example:
|
---|
2930 |
|
---|
2931 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 73
|
---|
2932 |
|
---|
2933 | \section1 warning(string)
|
---|
2934 |
|
---|
2935 | This function will always succeed, and will display the given
|
---|
2936 | \e string to the user. message() is a synonym for warning().
|
---|
2937 | */
|
---|
2938 |
|
---|
2939 | /*!
|
---|
2940 | \page qmake-environment-reference.html
|
---|
2941 | \contentspage {qmake Manual}{Contents}
|
---|
2942 | \previouspage qmake Function Reference
|
---|
2943 |
|
---|
2944 | \title Configuring qmake's Environment
|
---|
2945 |
|
---|
2946 | \tableofcontents
|
---|
2947 |
|
---|
2948 | \target Properties
|
---|
2949 | \section1 Properties
|
---|
2950 |
|
---|
2951 | \c qmake has a system of persistant information, this allows you to
|
---|
2952 | \c set a variable in qmake once, and each time qmake is invoked this
|
---|
2953 | value can be queried. Use the following to set a property in qmake:
|
---|
2954 |
|
---|
2955 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 74
|
---|
2956 |
|
---|
2957 | The appropriate variable and value should be substituted for
|
---|
2958 | \c VARIABLE and \c VALUE.
|
---|
2959 |
|
---|
2960 | To retrieve this information back from qmake you can do:
|
---|
2961 |
|
---|
2962 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 75
|
---|
2963 |
|
---|
2964 | \note \c{qmake -query} will only list variables that you have
|
---|
2965 | previously set with \c{qmake -set VARIABLE VALUE}.
|
---|
2966 |
|
---|
2967 | This information will be saved into a QSettings object (meaning it
|
---|
2968 | will be stored in different places for different platforms). As
|
---|
2969 | \c VARIABLE is versioned as well, you can set one value in an older
|
---|
2970 | version of \c qmake, and newer versions will retrieve this value. However,
|
---|
2971 | if you set \c VARIABLE for a newer version of \c qmake, the older version
|
---|
2972 | will not use this value. You can however query a specific version of a
|
---|
2973 | variable if you prefix that version of \c qmake to \c VARIABLE, as in
|
---|
2974 | the following example:
|
---|
2975 |
|
---|
2976 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 76
|
---|
2977 |
|
---|
2978 | \c qmake also has the notion of \c builtin properties, for example you can
|
---|
2979 | query the installation of Qt for this version of \c qmake with the
|
---|
2980 | \c QT_INSTALL_PREFIX property:
|
---|
2981 |
|
---|
2982 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 77
|
---|
2983 |
|
---|
2984 | These built-in properties cannot have a version prefixed to them as
|
---|
2985 | they are not versioned, and each version of \c qmake will have its own
|
---|
2986 | built-in set of these values. The list below outlines the built-in
|
---|
2987 | properties:
|
---|
2988 |
|
---|
2989 | \list
|
---|
2990 | \o \c QT_INSTALL_PREFIX - Where the version of Qt this qmake is built for resides
|
---|
2991 | \o \c QT_INSTALL_DATA - Where data for this version of Qt resides
|
---|
2992 | \o \c QMAKE_VERSION - The current version of qmake
|
---|
2993 | \endlist
|
---|
2994 |
|
---|
2995 | Finally, these values can be queried in a project file with a special
|
---|
2996 | notation such as:
|
---|
2997 |
|
---|
2998 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 78
|
---|
2999 |
|
---|
3000 | \target QMAKESPEC
|
---|
3001 | \section1 QMAKESPEC
|
---|
3002 |
|
---|
3003 | \c qmake requires a platform and compiler description file which
|
---|
3004 | contains many default values used to generate appropriate Makefiles.
|
---|
3005 | The standard Qt distribution comes with many of these files, located
|
---|
3006 | in the \c mkspecs subdirectory of the Qt installation.
|
---|
3007 |
|
---|
3008 | The \c QMAKESPEC environment variable can contain any of the following:
|
---|
3009 |
|
---|
3010 | \list
|
---|
3011 | \o A complete path to a directory containing a \c{qmake.conf} file.
|
---|
3012 | In this case \c qmake will open the \c{qmake.conf} file from within that
|
---|
3013 | directory. If the file does not exist, \c qmake will exit with an
|
---|
3014 | error.
|
---|
3015 | \o The name of a platform-compiler combination. In this case, \c qmake
|
---|
3016 | will search in the directory specified by the \c mkspecs subdirectory
|
---|
3017 | of the data path specified when Qt was compiled (see
|
---|
3018 | QLibraryInfo::DataPath).
|
---|
3019 | \endlist
|
---|
3020 |
|
---|
3021 | \bold{Note:} The \c QMAKESPEC path will automatically be added to the
|
---|
3022 | \l{qmake Variable Reference#INCLUDEPATH}{INCLUDEPATH} system variable.
|
---|
3023 |
|
---|
3024 | \target INSTALLS
|
---|
3025 | \section1 INSTALLS
|
---|
3026 |
|
---|
3027 | It is common on Unix to also use the build tool to install applications
|
---|
3028 | and libraries; for example, by invoking \c{make install}. For this reason,
|
---|
3029 | \c qmake has the concept of an install set, an object which contains
|
---|
3030 | instructions about the way part of a project is to be installed.
|
---|
3031 | For example, a collection of documentation files can be described in the
|
---|
3032 | following way:
|
---|
3033 |
|
---|
3034 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 79
|
---|
3035 |
|
---|
3036 | The \c path member informs \c qmake that the files should be installed in
|
---|
3037 | \c /usr/local/program/doc (the path member), and the \c files member
|
---|
3038 | specifies the files that should be copied to the installation directory.
|
---|
3039 | In this case, everything in the \c docs directory will be coped to
|
---|
3040 | \c /usr/local/program/doc.
|
---|
3041 |
|
---|
3042 | Once an install set has been fully described, you can append it to the
|
---|
3043 | install list with a line like this:
|
---|
3044 |
|
---|
3045 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 80
|
---|
3046 |
|
---|
3047 | \c qmake will ensure that the specified files are copied to the installation
|
---|
3048 | directory. If you require greater control over this process, you can also
|
---|
3049 | provide a definition for the \c extra member of the object. For example,
|
---|
3050 | the following line tells \c qmake to execute a series of commands for this
|
---|
3051 | install set:
|
---|
3052 |
|
---|
3053 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 81
|
---|
3054 |
|
---|
3055 | The \c unix scope
|
---|
3056 | (see \l{qmake Advanced Usage#Scopes and Conditions}{Scopes and Conditions})
|
---|
3057 | ensures that these particular commands are only executed on Unix platforms.
|
---|
3058 | Appropriate commands for other platforms can be defined using other scope
|
---|
3059 | rules.
|
---|
3060 |
|
---|
3061 | Commands specified in the \c extra member are executed before the instructions
|
---|
3062 | in the other members of the object are performed.
|
---|
3063 |
|
---|
3064 | If you append a built-in install set to the \c INSTALLS variable and do
|
---|
3065 | not specify \c files or \c extra members, \c qmake will decide what needs to
|
---|
3066 | be copied for you. Currently, the only supported built-in install set is
|
---|
3067 | \c target:
|
---|
3068 |
|
---|
3069 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 82
|
---|
3070 |
|
---|
3071 | In the above lines, \c qmake knows what needs to be copied, and will handle
|
---|
3072 | the installation process automatically.
|
---|
3073 |
|
---|
3074 | \target cache
|
---|
3075 | \section1 Cache File
|
---|
3076 |
|
---|
3077 | The cache file is a special file \c qmake reads to find settings not specified
|
---|
3078 | in the \c qmake.conf file, project files, or at the command line. If
|
---|
3079 | \c -nocache is not specified when \c qmake is run, it will try to find a file
|
---|
3080 | called \c{.qmake.cache} in parent directories of the current directory. If
|
---|
3081 | it fails to find this file, it will silently ignore this step of processing.
|
---|
3082 |
|
---|
3083 | If it finds a \c{.qmake.cache} file then it will process this file first before
|
---|
3084 | it processes the project file.
|
---|
3085 |
|
---|
3086 | \target LibDepend
|
---|
3087 | \section1 Library Dependencies
|
---|
3088 |
|
---|
3089 | Often when linking against a library, \c qmake relies on the underlying
|
---|
3090 | platform to know what other libraries this library links against, and
|
---|
3091 | lets the platform pull them in. In many cases, however, this is not
|
---|
3092 | sufficent. For example, when statically linking a library, no other
|
---|
3093 | libraries are linked to, and therefore no dependencies to those
|
---|
3094 | libraries are created. However, an application that later links
|
---|
3095 | against this library will need to know where to find the symbols that
|
---|
3096 | the static library will require. To help with this situation, \c qmake
|
---|
3097 | attempts to follow a library's dependencies where appropriate, but
|
---|
3098 | this behavior must be explicitly enabled by following two steps.
|
---|
3099 |
|
---|
3100 | The first step is to enable dependency tracking in the library itself.
|
---|
3101 | To do this you must tell \c qmake to save information about the library:
|
---|
3102 |
|
---|
3103 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 83
|
---|
3104 |
|
---|
3105 | This is only relevant to the \c lib template, and will be ignored for
|
---|
3106 | all others. When this option is enabled, \c qmake will create a file
|
---|
3107 | ending in .prl which will save some meta-information about the
|
---|
3108 | library. This metafile is just like an ordinary project file, but only
|
---|
3109 | contains internal variable declarations. You are free to view this file
|
---|
3110 | and, if it is deleted, \c qmake will know to recreate it when necessary,
|
---|
3111 | either when the project file is later read, or if a dependent library
|
---|
3112 | (described below) has changed. When installing this library, by
|
---|
3113 | specifying it as a target in an \c INSTALLS declaration, \c qmake will
|
---|
3114 | automatically copy the .prl file to the installation path.
|
---|
3115 |
|
---|
3116 | The second step in this process is to enable reading of this meta
|
---|
3117 | information in the applications that use the static library:
|
---|
3118 |
|
---|
3119 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 84
|
---|
3120 |
|
---|
3121 | When this is enabled, \c qmake will process all libraries linked to
|
---|
3122 | by the application and find their meta-information. \c qmake will use
|
---|
3123 | this to determine the relevant linking information, specifically adding
|
---|
3124 | values to the application project file's list of \c DEFINES as well as
|
---|
3125 | \c LIBS. Once \c qmake has processed this file, it will then look through
|
---|
3126 | the newly introduced libraries in the \c LIBS variable, and find their
|
---|
3127 | dependent .prl files, continuing until all libraries have been resolved.
|
---|
3128 | At this point, the Makefile is created as usual, and the libraries are
|
---|
3129 | linked explicitlyy against the application.
|
---|
3130 |
|
---|
3131 | The internals of the .prl file are left closed so they can easily
|
---|
3132 | change later. They are not designed to be changed by hand, should only
|
---|
3133 | be created by \c qmake, and should not be transferred between operating
|
---|
3134 | systems as they may contain platform-dependent information.
|
---|
3135 |
|
---|
3136 | \target Extensions
|
---|
3137 | \section1 File Extensions
|
---|
3138 |
|
---|
3139 | Under normal circumstances \c qmake will try to use appropriate file extensions
|
---|
3140 | for your platform. However, it is sometimes necessary to override the default
|
---|
3141 | choices for each platform and explicitly define file extensions for \c qmake to use.
|
---|
3142 | This is achieved by redefining certain built-in variables; for example the extension
|
---|
3143 | used for \l moc files can be redefined with the following assignment in a project
|
---|
3144 | file:
|
---|
3145 |
|
---|
3146 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 85
|
---|
3147 |
|
---|
3148 | The following variables can be used to redefine common file extensions recognized
|
---|
3149 | by \c qmake:
|
---|
3150 |
|
---|
3151 | \list
|
---|
3152 | \o QMAKE_EXT_MOC - This modifies the extension placed on included moc files.
|
---|
3153 | \o QMAKE_EXT_UI - This modifies the extension used for designer UI files (usually
|
---|
3154 | in \c FORMS).
|
---|
3155 | \o QMAKE_EXT_PRL - This modifies the extension placed on
|
---|
3156 | \l{#LibDepend}{library dependency files}.
|
---|
3157 | \o QMAKE_EXT_LEX - This changes the suffix used in files (usually in \c LEXSOURCES).
|
---|
3158 | \o QMAKE_EXT_YACC - This changes the suffix used in files (usually in \c YACCSOURCES).
|
---|
3159 | \o QMAKE_EXT_OBJ - This changes the suffix used on generated object files.
|
---|
3160 | \endlist
|
---|
3161 |
|
---|
3162 | All of the above accept just the first value, so you must assign to it just one
|
---|
3163 | value that will be used throughout your project file. There are two variables that
|
---|
3164 | accept a list of values:
|
---|
3165 |
|
---|
3166 | \list
|
---|
3167 | \o QMAKE_EXT_CPP - Causes \c qmake to interpret all files with these suffixes as
|
---|
3168 | C++ source files.
|
---|
3169 | \o QMAKE_EXT_H - Causes \c qmake to interpret all files with these suffixes as
|
---|
3170 | C and C++ header files.
|
---|
3171 | \endlist
|
---|
3172 |
|
---|
3173 | \target Customizing
|
---|
3174 | \section1 Customizing Makefile Output
|
---|
3175 |
|
---|
3176 | \c qmake tries to do everything expected of a cross-platform build tool.
|
---|
3177 | This is often less than ideal when you really need to run special
|
---|
3178 | platform-dependent commands. This can be achieved with specific instructions
|
---|
3179 | to the different \c qmake backends.
|
---|
3180 |
|
---|
3181 | Customization of the Makefile output is performed through an object-style
|
---|
3182 | API as found in other places in \c qmake. Objects are defined automatically
|
---|
3183 | by specifying their members; for example:
|
---|
3184 |
|
---|
3185 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 86
|
---|
3186 |
|
---|
3187 | The definitions above define a \c qmake target called \c mytarget, containing
|
---|
3188 | a Makefile target called \c{.buildfile} which in turn is generated with
|
---|
3189 | the \c touch command. Finally, the \c{.depends} member specifies that
|
---|
3190 | \c mytarget depends on \c mytarget2, another target that is defined afterwards.
|
---|
3191 | \c mytarget2 is a dummy target; it is only defined to echo some text to
|
---|
3192 | the console.
|
---|
3193 |
|
---|
3194 | The final step is to instruct \c qmake that this object is a target to be built:
|
---|
3195 |
|
---|
3196 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 87
|
---|
3197 |
|
---|
3198 | This is all you need to do to actually build custom targets. Of course, you may
|
---|
3199 | want to tie one of these targets to the
|
---|
3200 | \l{qmake Variable Reference#TARGET}{qmake build target}. To do this, you simply need to
|
---|
3201 | include your Makefile target in the list of
|
---|
3202 | \l{qmake Variable Reference#PRE_TARGETDEPS}{PRE_TARGETDEPS}.
|
---|
3203 |
|
---|
3204 | The following tables are an overview of the options available to you with the QMAKE_EXTRA_TARGETS
|
---|
3205 | variable.
|
---|
3206 |
|
---|
3207 | \table
|
---|
3208 | \header
|
---|
3209 | \o Member
|
---|
3210 | \o Description
|
---|
3211 | \row
|
---|
3212 | \o commands
|
---|
3213 | \o The commands for generating the custom build target.
|
---|
3214 | \row
|
---|
3215 | \o CONFIG
|
---|
3216 | \o Specific configuration options for the custom build target. See the CONFIG table for details.
|
---|
3217 | \row
|
---|
3218 | \o depends
|
---|
3219 | \o The existing build targets that the custom build target depends on.
|
---|
3220 | \row
|
---|
3221 | \o recurse
|
---|
3222 | \o Specifies which sub-targets should used when creating the rules in the Makefile to call in
|
---|
3223 | the sub-target specific Makefile. This is only used when \c recursive is set in the CONFIG.
|
---|
3224 | \row
|
---|
3225 | \o recurse_target
|
---|
3226 | \o Specifies the target that should be built via the sub-target Makefile for the rule in the Makefile.
|
---|
3227 | This adds something like $(MAKE) -f Makefile.[subtarget] [recurse_target]. This is only used when
|
---|
3228 | \c recursive is set in the CONFIG.
|
---|
3229 | \row
|
---|
3230 | \o target
|
---|
3231 | \o The file being created by the custom build target.
|
---|
3232 | \endtable
|
---|
3233 |
|
---|
3234 | List of members specific to the CONFIG option:
|
---|
3235 |
|
---|
3236 | \table
|
---|
3237 | \header
|
---|
3238 | \o Member
|
---|
3239 | \o Description
|
---|
3240 | \row
|
---|
3241 | \o recursive
|
---|
3242 | \o Indicates that rules should be created in the Makefile and thus call
|
---|
3243 | the relevant target inside the sub-target specific Makefile. This defaults to creating
|
---|
3244 | an entry for each of the sub-targets.
|
---|
3245 | \endtable
|
---|
3246 |
|
---|
3247 | For convenience, there is also a method of customizing projects
|
---|
3248 | for new compilers or preprocessors:
|
---|
3249 |
|
---|
3250 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 88
|
---|
3251 |
|
---|
3252 | With the above definitions, you can use a drop-in replacement for moc if one
|
---|
3253 | is available. The commands is executed on all arguments given to the
|
---|
3254 | \c NEW_HEADERS variable (from the \c input member), and the result is written
|
---|
3255 | to the file defined by the \c output member; this file is added to the
|
---|
3256 | other source files in the project.
|
---|
3257 | Additionally, \c qmake will execute \c depend_command to generate dependency
|
---|
3258 | information, and place this information in the project as well.
|
---|
3259 |
|
---|
3260 | These commands can easily be placed into a cache file, allowing subsequent
|
---|
3261 | project files to add arguments to \c NEW_HEADERS.
|
---|
3262 |
|
---|
3263 | The following tables are an overview of the options available to you with the QMAKE_EXTRA_COMPILERS
|
---|
3264 | variable.
|
---|
3265 |
|
---|
3266 | \table
|
---|
3267 | \header
|
---|
3268 | \o Member
|
---|
3269 | \o Description
|
---|
3270 | \row
|
---|
3271 | \o commands
|
---|
3272 | \o The commands used for for generating the output from the input.
|
---|
3273 | \row
|
---|
3274 | \o CONFIG
|
---|
3275 | \o Specific configuration options for the custom compiler. See the CONFIG table for details.
|
---|
3276 | \row
|
---|
3277 | \o depend_command
|
---|
3278 | \o Specifies a command used to generate the list of dependencies for the output.
|
---|
3279 | \row
|
---|
3280 | \o dependency_type
|
---|
3281 | \o Specifies the type of file the output is, if it is a known type (such as TYPE_C,
|
---|
3282 | TYPE_UI, TYPE_QRC) then it is handled as one of those type of files.
|
---|
3283 | \row
|
---|
3284 | \o depends
|
---|
3285 | \o Specifies the dependencies of the output file.
|
---|
3286 | \row
|
---|
3287 | \o input
|
---|
3288 | \o The variable that contains the files that should be processed with the custom compiler.
|
---|
3289 | \row
|
---|
3290 | \o name
|
---|
3291 | \o A description of what the custom compiler is doing. This is only used in some backends.
|
---|
3292 | \row
|
---|
3293 | \o output
|
---|
3294 | \o The filename that is created from the custom compiler.
|
---|
3295 | \row
|
---|
3296 | \o output_function
|
---|
3297 | \o Specifies a custom qmake function that is used to specify the filename to be created.
|
---|
3298 | \row
|
---|
3299 | \o variables
|
---|
3300 | \o Indicates that the variables specified here are replaced with $(QMAKE_COMP_VARNAME) when refered to
|
---|
3301 | in the pro file as $(VARNAME).
|
---|
3302 | \row
|
---|
3303 | \o variable_out
|
---|
3304 | \o The variable that the files created from the output should be added to.
|
---|
3305 | \endtable
|
---|
3306 |
|
---|
3307 | List of members specific to the CONFIG option:
|
---|
3308 |
|
---|
3309 | \table
|
---|
3310 | \header
|
---|
3311 | \o Member
|
---|
3312 | \o Description
|
---|
3313 | \row
|
---|
3314 | \o combine
|
---|
3315 | \o Indicates that all of the input files are combined into a single output file.
|
---|
3316 | \row
|
---|
3317 | \o target_predeps
|
---|
3318 | \o Indicates that the output should be added to the list of PRE_TARGETDEPS.
|
---|
3319 | \row
|
---|
3320 | \o explicit_dependencies
|
---|
3321 | \o The dependencies for the output only get generated from the depends member and from
|
---|
3322 | nowhere else.
|
---|
3323 | \row
|
---|
3324 | \o no_link
|
---|
3325 | \o Indicates that the output should not be added to the list of objects to be linked in
|
---|
3326 | \endtable
|
---|
3327 | */
|
---|
3328 |
|
---|
3329 | /*!
|
---|
3330 | \page qmake-advanced-usage.html
|
---|
3331 | \title qmake Advanced Usage
|
---|
3332 | \contentspage {qmake Manual}{Contents}
|
---|
3333 | \previouspage qmake Platform Notes
|
---|
3334 | \nextpage Using Precompiled Headers
|
---|
3335 |
|
---|
3336 | Many \c qmake project files simply describe the sources and header files used
|
---|
3337 | by the project, using a list of \c{name = value} and \c{name += value}
|
---|
3338 | definitions. \c qmake also provides other operators, functions, and scopes
|
---|
3339 | that can be used to process the information supplied in variable declarations.
|
---|
3340 | These advanced features allow Makefiles to be generated for multiple platforms
|
---|
3341 | from a single project file.
|
---|
3342 |
|
---|
3343 | \tableofcontents
|
---|
3344 |
|
---|
3345 | \section1 Operators
|
---|
3346 |
|
---|
3347 | In many project files, the assignment (\c{=}) and append (\c{+=}) operators can
|
---|
3348 | be used to include all the information about a project. The typical pattern of
|
---|
3349 | use is to assign a list of values to a variable, and append more values
|
---|
3350 | depending on the result of various tests. Since \c qmake defines certain
|
---|
3351 | variables using default values, it is sometimes necessary to use the removal
|
---|
3352 | (\c{-=}) operator to filter out values that are not required. The following
|
---|
3353 | operators can be used to manipulate the contents of variables.
|
---|
3354 |
|
---|
3355 | The \c = operator assigns a value to a variable:
|
---|
3356 |
|
---|
3357 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 89
|
---|
3358 |
|
---|
3359 | The above line sets the \c TARGET variable to \c myapp. This will overwrite any
|
---|
3360 | values previously set for \c TARGET with \c myapp.
|
---|
3361 |
|
---|
3362 | The \c += operator appends a new value to the list of values in a variable:
|
---|
3363 |
|
---|
3364 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 90
|
---|
3365 |
|
---|
3366 | The above line appends \c QT_DLL to the list of pre-processor defines to be put
|
---|
3367 | in the generated Makefile.
|
---|
3368 |
|
---|
3369 | The \c -= operator removes a value from the list of values in a variable:
|
---|
3370 |
|
---|
3371 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 91
|
---|
3372 |
|
---|
3373 | The above line removes \c QT_DLL from the list of pre-processor defines to be
|
---|
3374 | put in the generated Makefile.
|
---|
3375 |
|
---|
3376 | The \c *= operator adds a value to the list of values in a variable, but only
|
---|
3377 | if it is not already present. This prevents values from being included many
|
---|
3378 | times in a variable. For example:
|
---|
3379 |
|
---|
3380 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 92
|
---|
3381 |
|
---|
3382 | In the above line, \c QT_DLL will only be added to the list of pre-processor
|
---|
3383 | defines if it is not already defined. Note that the
|
---|
3384 | \l{qmake Function Reference#unique}{unique()}
|
---|
3385 | function can also be used to ensure that a variables only contains one
|
---|
3386 | instance of each value.
|
---|
3387 |
|
---|
3388 | The \c ~= operator replaces any values that match a regular expression with
|
---|
3389 | the specified value:
|
---|
3390 |
|
---|
3391 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 93
|
---|
3392 |
|
---|
3393 | In the above line, any values in the list that start with \c QT_D or \c QT_T are
|
---|
3394 | replaced with \c QT.
|
---|
3395 |
|
---|
3396 | The \c $$ operator is used to extract the contents of a variable, and can be
|
---|
3397 | used to pass values between variables or supply them to functions:
|
---|
3398 |
|
---|
3399 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 94
|
---|
3400 |
|
---|
3401 | \target Scopes
|
---|
3402 | \section1 Scopes
|
---|
3403 |
|
---|
3404 | Scopes are similar to \c if statements in procedural programming languages.
|
---|
3405 | If a certain condition is true, the declarations inside the scope are processed.
|
---|
3406 |
|
---|
3407 | \section2 Syntax
|
---|
3408 |
|
---|
3409 | Scopes consist of a condition followed by an opening brace on the same line,
|
---|
3410 | a sequence of commands and definitions, and a closing brace on a new line:
|
---|
3411 |
|
---|
3412 | \snippet doc/src/snippets/qmake/scopes.pro syntax
|
---|
3413 |
|
---|
3414 | The opening brace \e{must be written on the same line as the condition}.
|
---|
3415 | Scopes may be concatenated to include more than one condition; see below
|
---|
3416 | for examples.
|
---|
3417 |
|
---|
3418 | \section2 Scopes and Conditions
|
---|
3419 |
|
---|
3420 | A scope is written as a condition followed by a series of declarations
|
---|
3421 | contained within a pair of braces; for example:
|
---|
3422 |
|
---|
3423 | \snippet doc/src/snippets/qmake/scopes.pro 0
|
---|
3424 |
|
---|
3425 | The above code will add the \c paintwidget_win.cpp file to the sources listed
|
---|
3426 | in the generated Makefile if \c qmake is used on a Windows platform.
|
---|
3427 | If \c qmake is used on a platform other than Windows, the define will be
|
---|
3428 | ignored.
|
---|
3429 |
|
---|
3430 | The conditions used in a given scope can also be negated to provide an
|
---|
3431 | alternative set of declarations that will be processed only if the
|
---|
3432 | original condition is false. For example, suppose we want to process
|
---|
3433 | something on all platforms \e except for Windows. We can achieve this by
|
---|
3434 | negating the scope like this:
|
---|
3435 |
|
---|
3436 | \snippet doc/src/snippets/qmake/scopes.pro 1
|
---|
3437 |
|
---|
3438 | Scopes can be nested to combine more than one condition. For instance, if
|
---|
3439 | you want to include a particular file for a certain platform only if
|
---|
3440 | debugging is enabled then you write the following:
|
---|
3441 |
|
---|
3442 | \snippet doc/src/snippets/qmake/scopes.pro 2
|
---|
3443 |
|
---|
3444 | To save writing many nested scopes, you can nest scopes using the \c :
|
---|
3445 | operator. The nested scopes in the above example can be rewritten in
|
---|
3446 | the following way:
|
---|
3447 |
|
---|
3448 | \snippet doc/src/snippets/qmake/scopes.pro 3
|
---|
3449 |
|
---|
3450 | You may also use the \c : operator to perform single line conditional
|
---|
3451 | assignments; for example:
|
---|
3452 |
|
---|
3453 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 95
|
---|
3454 |
|
---|
3455 | The above line adds \c QT_DLL to the \c DEFINES variable only on the
|
---|
3456 | Windows platform.
|
---|
3457 | Generally, the \c : operator behaves like a logical AND operator, joining
|
---|
3458 | together a number of conditions, and requiring all of them to be true.
|
---|
3459 |
|
---|
3460 | There is also the \c | operator to act like a logical OR operator, joining
|
---|
3461 | together a number of conditions, and requiring only one of them to be true.
|
---|
3462 |
|
---|
3463 | \snippet doc/src/snippets/qmake/scopes.pro 4
|
---|
3464 |
|
---|
3465 | You can also provide alternative declarations to those within a scope by
|
---|
3466 | using an \c else scope. Each \c else scope is processed if the conditions
|
---|
3467 | for the preceding scopes are false.
|
---|
3468 | This allows you to write complex tests when combined with other scopes
|
---|
3469 | (separated by the \c : operator as above). For example:
|
---|
3470 |
|
---|
3471 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 96
|
---|
3472 |
|
---|
3473 | \section2 Configuration and Scopes
|
---|
3474 |
|
---|
3475 | The values stored in the
|
---|
3476 | \l{qmake-project-files.html#GeneralConfiguration}{\c CONFIG variable}
|
---|
3477 | are treated specially by \c qmake. Each of the possible values can be
|
---|
3478 | used as the condition for a scope. For example, the list of values
|
---|
3479 | held by \c CONFIG can be extended with the \c opengl value:
|
---|
3480 |
|
---|
3481 | \snippet doc/src/snippets/qmake/configscopes.pro 0
|
---|
3482 |
|
---|
3483 | As a result of this operation, any scopes that test for \c opengl will
|
---|
3484 | be processed. We can use this feature to give the final executable an
|
---|
3485 | appropriate name:
|
---|
3486 |
|
---|
3487 | \snippet doc/src/snippets/qmake/configscopes.pro 1
|
---|
3488 | \snippet doc/src/snippets/qmake/configscopes.pro 2
|
---|
3489 | \snippet doc/src/snippets/qmake/configscopes.pro 3
|
---|
3490 |
|
---|
3491 | This feature makes it easy to change the configuration for a project
|
---|
3492 | without losing all the custom settings that might be needed for a specific
|
---|
3493 | configuration. In the above code, the declarations in the first scope are
|
---|
3494 | processed, and the final executable will be called \c application-gl.
|
---|
3495 | However, if \c opengl is not specified, the declarations in the second
|
---|
3496 | scope are processed instead, and the final executable will be called
|
---|
3497 | \c application.
|
---|
3498 |
|
---|
3499 | Since it is possible to put your own values on the \c CONFIG
|
---|
3500 | line, this provides you with a convenient way to customize project files
|
---|
3501 | and fine-tune the generated Makefiles.
|
---|
3502 |
|
---|
3503 | \section2 Platform Scope Values
|
---|
3504 |
|
---|
3505 | In addition to the \c win32, \c macx, and \c unix values used in many
|
---|
3506 | scope conditions, various other built-in platform and compiler-specific
|
---|
3507 | values can be tested with scopes. These are based on platform
|
---|
3508 | specifications provided in Qt's \c mkspecs directory. For example, the
|
---|
3509 | following lines from a project file show the current specification in
|
---|
3510 | use and test for the \c linux-g++ specification:
|
---|
3511 |
|
---|
3512 | \snippet doc/src/snippets/qmake/specifications.pro 0
|
---|
3513 |
|
---|
3514 | You can test for any other platform-compiler combination as long as a
|
---|
3515 | specification exists for it in the \c mkspecs directory.
|
---|
3516 |
|
---|
3517 | \section1 Variables
|
---|
3518 |
|
---|
3519 | Many of the variables used in project files are special variables that
|
---|
3520 | \c qmake uses when generating Makefiles, such as \c DEFINES, \c SOURCES,
|
---|
3521 | and \c HEADERS. It is possible for you to create variables for your own
|
---|
3522 | use; \c qmake creates new variables with a given name when it encounters
|
---|
3523 | an assignment to that name. For example:
|
---|
3524 |
|
---|
3525 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 97
|
---|
3526 |
|
---|
3527 | There are no restricitions on what you do to your own variables, as \c
|
---|
3528 | qmake will ignore them unless it needs to evaluate them when processing
|
---|
3529 | a scope.
|
---|
3530 |
|
---|
3531 | You can also assign the value of a current variable to another
|
---|
3532 | variable by prefixing $$ to the variable name. For example:
|
---|
3533 |
|
---|
3534 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 98
|
---|
3535 |
|
---|
3536 | Now the MY_DEFINES variable contains what is in the DEFINES variable at
|
---|
3537 | this point in the project file. This is also equivalent to:
|
---|
3538 |
|
---|
3539 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 99
|
---|
3540 |
|
---|
3541 | The second notation allows you to append the contents of the variable to
|
---|
3542 | another value without separating the two with a space. For example, the
|
---|
3543 | following will ensure that the final executable will be given a name
|
---|
3544 | that includes the project template being used:
|
---|
3545 |
|
---|
3546 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 100
|
---|
3547 |
|
---|
3548 | Variables can be used to store the contents of environment variables.
|
---|
3549 | These can be evaluated at the time that \c qmake is run, or included
|
---|
3550 | in the generated Makefile for evaluation when the project is built.
|
---|
3551 |
|
---|
3552 | To obtain the contents of an environment value when \c qmake is run,
|
---|
3553 | use the \c $$(...) operator:
|
---|
3554 |
|
---|
3555 | \snippet doc/src/snippets/qmake/environment.pro 0
|
---|
3556 |
|
---|
3557 | In the above assignment, the value of the \c PWD environment variable
|
---|
3558 | is read when the project file is processed.
|
---|
3559 |
|
---|
3560 | To obtain the contents of an environment value at the time when the
|
---|
3561 | generated Makefile is processed, use the \c $(...) operator:
|
---|
3562 |
|
---|
3563 | \snippet doc/src/snippets/qmake/environment.pro 1
|
---|
3564 |
|
---|
3565 | In the above assignment, the value of \c PWD is read immediately
|
---|
3566 | when the project file is processed, but \c $(PWD) is assigned to
|
---|
3567 | \c DESTDIR in the generated Makefile. This makes the build process
|
---|
3568 | more flexible as long as the environment variable is set correctly
|
---|
3569 | when the Makefile is processed.
|
---|
3570 |
|
---|
3571 | The special \c $$[...] operator can be used to access various
|
---|
3572 | configuration options that were set when Qt was built:
|
---|
3573 |
|
---|
3574 | \snippet doc/src/snippets/qmake/qtconfiguration.pro 0
|
---|
3575 |
|
---|
3576 | The variables accessible with this operator are typically used to
|
---|
3577 | enable third party plugins and components to be integrated with Qt.
|
---|
3578 | For example, a \QD plugin can be installed alongside \QD's built-in
|
---|
3579 | plugins if the following declaration is made in its project file:
|
---|
3580 |
|
---|
3581 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 101
|
---|
3582 |
|
---|
3583 | \target VariableProcessingFunctions
|
---|
3584 | \section1 Variable Processing Functions
|
---|
3585 |
|
---|
3586 | \c qmake provides a selection of built-in functions to allow the
|
---|
3587 | contents of variables to be processed. These functions process the
|
---|
3588 | arguments supplied to them and return a value, or list of values, as
|
---|
3589 | a result. In order to assign a result to a variable, it is necessary
|
---|
3590 | to use the \c $$ operator with this type of function in the same way
|
---|
3591 | used to assign contents of one variable to another:
|
---|
3592 |
|
---|
3593 | \snippet doc/src/snippets/qmake/functions.pro 1
|
---|
3594 |
|
---|
3595 | This type of function should be used on the right-hand side of
|
---|
3596 | assignments (i.e, as an operand).
|
---|
3597 |
|
---|
3598 | It is possible to define your own functions for processing the
|
---|
3599 | contents of variables. These functions can be defined in the following
|
---|
3600 | way:
|
---|
3601 |
|
---|
3602 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 102
|
---|
3603 |
|
---|
3604 | The following example function takes a variable name as its only
|
---|
3605 | argument, extracts a list of values from the variable with the
|
---|
3606 | \l{qmake-function-reference.html}{eval()} built-in function,
|
---|
3607 | and compiles a list of files:
|
---|
3608 |
|
---|
3609 | \snippet doc/src/snippets/qmake/replacefunction.pro 0
|
---|
3610 |
|
---|
3611 | \target ConditionalFunctions
|
---|
3612 | \section1 Conditional Functions
|
---|
3613 |
|
---|
3614 | \c qmake provides built-in functions that can be used as conditions
|
---|
3615 | when writing scopes. These functions do not return a value, but
|
---|
3616 | instead indicate "success" or "failure":
|
---|
3617 |
|
---|
3618 | \snippet doc/src/snippets/qmake/functions.pro 3
|
---|
3619 |
|
---|
3620 | This type of function should be used in conditional expressions
|
---|
3621 | only.
|
---|
3622 |
|
---|
3623 | It is possible to define your own functions to provide conditions
|
---|
3624 | for scopes. The following example tests whether each file in a list
|
---|
3625 | exists and returns true if they all exist, or false if not:
|
---|
3626 |
|
---|
3627 | \snippet doc/src/snippets/qmake/testfunction.pro 0
|
---|
3628 |
|
---|
3629 | \section1 Adding New Configuration Features
|
---|
3630 |
|
---|
3631 | \c qmake lets you create your own \e features that can be included in
|
---|
3632 | project files by adding their names to the list of values specified by
|
---|
3633 | the \c CONFIG variable. Features are collections of custom functions and
|
---|
3634 | definitions in \c{.prf} files that can reside in one of many standard
|
---|
3635 | directories. The locations of these directories are defined in a number
|
---|
3636 | of places, and \c qmake checks each of them in the following order when
|
---|
3637 | it looks for \c{.prf} files:
|
---|
3638 |
|
---|
3639 | \list 1
|
---|
3640 | \o In a directory listed in the \c QMAKEFEATURES environment variable;
|
---|
3641 | this contains a colon-separated list of directories.
|
---|
3642 | \o In a directory listed in the \c QMAKEFEATURES property variable; this
|
---|
3643 | contains a colon-spearated list of directories.
|
---|
3644 | \omit
|
---|
3645 | \o In a features directory beneath the project's root directory (where
|
---|
3646 | the \c{.qmake.cache} file is generated).
|
---|
3647 | \endomit
|
---|
3648 | \o In a features directory residing within a \c mkspecs directory.
|
---|
3649 | \c mkspecs directories can be located beneath any of the directories
|
---|
3650 | listed in the \c QMAKEPATH environment variable (a colon-separated list
|
---|
3651 | of directories). (\c{$QMAKEPATH/mkspecs/<features>})
|
---|
3652 | \o In a features directory residing beneath the directory provided by the
|
---|
3653 | \c QMAKESPEC environment variable. (\c{$QMAKESPEC/<features>})
|
---|
3654 | \o In a features directory residing in the \c data_install/mkspecs directory.
|
---|
3655 | (\c{data_install/mkspecs/<features>})
|
---|
3656 | \o In a features directory that exists as a sibling of the directory
|
---|
3657 | specified by the \c QMAKESPEC environment variable.
|
---|
3658 | (\c{$QMAKESPEC/../<features>})
|
---|
3659 | \endlist
|
---|
3660 |
|
---|
3661 | The following features directories are searched for features files:
|
---|
3662 |
|
---|
3663 | \list 1
|
---|
3664 | \o \c{features/unix}, \c{features/win32}, or \c{features/macx}, depending on
|
---|
3665 | the platform in use
|
---|
3666 | \o \c features/
|
---|
3667 | \endlist
|
---|
3668 |
|
---|
3669 | For example, consider the following assignment in a project file:
|
---|
3670 |
|
---|
3671 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 103
|
---|
3672 |
|
---|
3673 | With this addition to the \c CONFIG variable, \c qmake will search the
|
---|
3674 | locations listed above for the \c myfeatures.prf file after it has
|
---|
3675 | finished parsing your project file. On Unix systems, it will look for
|
---|
3676 | the following file:
|
---|
3677 |
|
---|
3678 | \list 1
|
---|
3679 | \o \c $QMAKEFEATURES/myfeatures.prf (for each directory listed in the
|
---|
3680 | \c QMAKEFEATURES environment variable)
|
---|
3681 | \o \c $$QMAKEFEATURES/myfeatures.prf (for each directory listed in the
|
---|
3682 | \c QMAKEFEATURES property variable)
|
---|
3683 | \o \c myfeatures.prf (in the project's root directory)
|
---|
3684 | \o \c $QMAKEPATH/mkspecs/features/unix/myfeatures.prf and
|
---|
3685 | \c $QMAKEPATH/mkspecs/features/myfeatures.prf (for each directory
|
---|
3686 | listed in the \c QMAKEPATH environment variable)
|
---|
3687 | \o \c $QMAKESPEC/features/unix/myfeatures.prf and
|
---|
3688 | \c $QMAKESPEC/features/myfeatures.prf
|
---|
3689 | \o \c data_install/mkspecs/features/unix/myfeatures.prf and
|
---|
3690 | \c data_install/mkspecs/features/myfeatures.prf
|
---|
3691 | \o \c $QMAKESPEC/../features/unix/myfeatures.prf and
|
---|
3692 | \c $QMAKESPEC/../features/myfeatures.prf
|
---|
3693 | \endlist
|
---|
3694 |
|
---|
3695 | \note The \c{.prf} files must have names in lower case.
|
---|
3696 |
|
---|
3697 |
|
---|
3698 | */
|
---|
3699 |
|
---|
3700 | /*!
|
---|
3701 | \page qmake-precompiledheaders.html
|
---|
3702 | \title Using Precompiled Headers
|
---|
3703 | \contentspage {qmake Manual}{Contents}
|
---|
3704 | \previouspage qmake Advanced Usage
|
---|
3705 | \nextpage qmake Reference
|
---|
3706 | \ingroup buildsystem
|
---|
3707 |
|
---|
3708 | \target Introduction
|
---|
3709 |
|
---|
3710 | Precompiled headers are a performance feature supported by some
|
---|
3711 | compilers to compile a stable body of code, and store the compiled
|
---|
3712 | state of the code in a binary file. During subsequent compilations,
|
---|
3713 | the compiler will load the stored state, and continue compiling the
|
---|
3714 | specified file. Each subsequent compilation is faster because the
|
---|
3715 | stable code does not need to be recompiled.
|
---|
3716 |
|
---|
3717 | \c qmake supports the use of precompiled headers (PCH) on some
|
---|
3718 | platforms and build environments, including:
|
---|
3719 | \list
|
---|
3720 | \o Windows
|
---|
3721 | \list
|
---|
3722 | \o nmake
|
---|
3723 | \o Dsp projects (VC 6.0)
|
---|
3724 | \o Vcproj projects (VC 7.0 \& 7.1)
|
---|
3725 | \endlist
|
---|
3726 | \o Mac OS X
|
---|
3727 | \list
|
---|
3728 | \o Makefile
|
---|
3729 | \o Xcode
|
---|
3730 | \endlist
|
---|
3731 | \o Unix
|
---|
3732 | \list
|
---|
3733 | \o GCC 3.4 and above
|
---|
3734 | \endlist
|
---|
3735 | \endlist
|
---|
3736 |
|
---|
3737 | \target ADD_PCH
|
---|
3738 | \section1 Adding Precompiled Headers to Your Project
|
---|
3739 |
|
---|
3740 | \target PCH_CONTENTS
|
---|
3741 | \section2 Contents of the Precompiled Header File
|
---|
3742 |
|
---|
3743 | The precompiled header must contain code which is \e stable
|
---|
3744 | and \e static throughout your project. A typical PCH might look
|
---|
3745 | like this:
|
---|
3746 |
|
---|
3747 | \section3 Example: \c stable.h
|
---|
3748 |
|
---|
3749 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 104
|
---|
3750 |
|
---|
3751 | Note that a precompiled header file needs to separate C includes from
|
---|
3752 | C++ includes, since the precompiled header file for C files may not
|
---|
3753 | contain C++ code.
|
---|
3754 |
|
---|
3755 | \target PROJECT_OPTIONS
|
---|
3756 | \section2 Project Options
|
---|
3757 |
|
---|
3758 | To make your project use PCH, you only need to define the
|
---|
3759 | \c PRECOMPILED_HEADER variable in your project file:
|
---|
3760 |
|
---|
3761 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 105
|
---|
3762 |
|
---|
3763 | \c qmake will handle the rest, to ensure the creation and use of the
|
---|
3764 | precompiled header file. You do not need to include the precompiled
|
---|
3765 | header file in \c HEADERS, as \c qmake will do this if the configuration
|
---|
3766 | supports PCH.
|
---|
3767 |
|
---|
3768 | All platforms that support precompiled headers have the configuration
|
---|
3769 | option \c precompile_header set. Using this option, you may trigger
|
---|
3770 | conditional blocks in your project file to add settings when using PCH.
|
---|
3771 | For example:
|
---|
3772 |
|
---|
3773 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 106
|
---|
3774 |
|
---|
3775 | \section1 Notes on Possible Issues
|
---|
3776 |
|
---|
3777 | On some platforms, the file name suffix for precompiled header files is
|
---|
3778 | the same as that for other object files. For example, the following
|
---|
3779 | declarations may cause two different object files with the same name to
|
---|
3780 | be generated:
|
---|
3781 |
|
---|
3782 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 107
|
---|
3783 |
|
---|
3784 | To avoid potential conflicts like these, it is good practice to ensure
|
---|
3785 | that header files that will be precompiled are given distinctive names.
|
---|
3786 |
|
---|
3787 | \target EXAMPLE_PROJECT
|
---|
3788 | \section1 Example Project
|
---|
3789 |
|
---|
3790 | You can find the following source code in the
|
---|
3791 | \c{examples/qmake/precompile} directory in the Qt distribution:
|
---|
3792 |
|
---|
3793 | \section2 \c mydialog.ui
|
---|
3794 |
|
---|
3795 | \quotefromfile examples/qmake/precompile/mydialog.ui
|
---|
3796 | \printuntil
|
---|
3797 |
|
---|
3798 | \section2 \c stable.h
|
---|
3799 |
|
---|
3800 | \snippet examples/qmake/precompile/stable.h 0
|
---|
3801 |
|
---|
3802 | \section2 \c myobject.h
|
---|
3803 |
|
---|
3804 | \snippet examples/qmake/precompile/myobject.h 0
|
---|
3805 |
|
---|
3806 | \section2 \c myobject.cpp
|
---|
3807 |
|
---|
3808 | \snippet examples/qmake/precompile/myobject.cpp 0
|
---|
3809 |
|
---|
3810 | \section2 \c util.cpp
|
---|
3811 |
|
---|
3812 | \snippet examples/qmake/precompile/util.cpp 0
|
---|
3813 |
|
---|
3814 | \section2 \c main.cpp
|
---|
3815 |
|
---|
3816 | \snippet examples/qmake/precompile/main.cpp 0
|
---|
3817 |
|
---|
3818 | \section2 \c precompile.pro
|
---|
3819 |
|
---|
3820 | \snippet examples/qmake/precompile/precompile.pro 0
|
---|
3821 | */
|
---|
3822 |
|
---|
3823 | /*!
|
---|
3824 | \page qmake-tutorial.html
|
---|
3825 | \title qmake Tutorial
|
---|
3826 | \contentspage {qmake Manual}{Contents}
|
---|
3827 | \previouspage qmake Manual
|
---|
3828 | \nextpage qmake Common Projects
|
---|
3829 |
|
---|
3830 | This tutorial teaches you how to use \c qmake. We recommend that
|
---|
3831 | you read the \c qmake user guide after completing this tutorial.
|
---|
3832 |
|
---|
3833 | \section1 Starting off Simple
|
---|
3834 |
|
---|
3835 | Let's assume that you have just finished a basic implementation of
|
---|
3836 | your application, and you have created the following files:
|
---|
3837 |
|
---|
3838 | \list
|
---|
3839 | \o hello.cpp
|
---|
3840 | \o hello.h
|
---|
3841 | \o main.cpp
|
---|
3842 | \endlist
|
---|
3843 |
|
---|
3844 | You will find these files in the \c{examples/qmake/tutorial} directory
|
---|
3845 | of the Qt distribution. The only other thing you know about the setup of
|
---|
3846 | the application is that it's written in Qt. First, using your favorite
|
---|
3847 | plain text editor, create a file called \c hello.pro in
|
---|
3848 | \c{examples/qmake/tutorial}. The first thing you need to do is add the
|
---|
3849 | lines that tell \c qmake about the source and header files that are part
|
---|
3850 | of your development project.
|
---|
3851 |
|
---|
3852 | We'll add the source files to the project file first. To do this you
|
---|
3853 | need to use the \l{qmake Variable Reference#SOURCES}{SOURCES} variable.
|
---|
3854 | Just start a new line with \c {SOURCES +=} and put hello.cpp after it.
|
---|
3855 | You should have something like this:
|
---|
3856 |
|
---|
3857 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 108
|
---|
3858 |
|
---|
3859 | We repeat this for each source file in the project, until we end up
|
---|
3860 | with the following:
|
---|
3861 |
|
---|
3862 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 109
|
---|
3863 |
|
---|
3864 | If you prefer to use a Make-like syntax, with all the files listed in
|
---|
3865 | one go you can use the newline escaping like this:
|
---|
3866 |
|
---|
3867 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 110
|
---|
3868 |
|
---|
3869 | Now that the source files are listed in the project file, the header
|
---|
3870 | files must be added. These are added in exactly the same way as source
|
---|
3871 | files, except that the variable name we use is
|
---|
3872 | \l{qmake Variable Reference#HEADERS}{HEADERS}.
|
---|
3873 |
|
---|
3874 | Once you have done this, your project file should look something like
|
---|
3875 | this:
|
---|
3876 |
|
---|
3877 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 111
|
---|
3878 |
|
---|
3879 | The target name is set automatically; it is the same as the project
|
---|
3880 | file, but with the suffix appropriate to the platform. For example, if
|
---|
3881 | the project file is called \c hello.pro, the target will be \c hello.exe
|
---|
3882 | on Windows and \c hello on Unix. If you want to use a different name
|
---|
3883 | you can set it in the project file:
|
---|
3884 |
|
---|
3885 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 112
|
---|
3886 |
|
---|
3887 | The final step is to set the \l{qmake Variable Reference#CONFIG}{CONFIG}
|
---|
3888 | variable. Since this is a Qt application, we need to put \c qt on the
|
---|
3889 | \c CONFIG line so that \c qmake will add the relevant libraries to be
|
---|
3890 | linked against and ensure that build lines for \c moc and \c uic are
|
---|
3891 | included in the generated Makefile.
|
---|
3892 |
|
---|
3893 | The finished project file should look like this:
|
---|
3894 |
|
---|
3895 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113
|
---|
3896 |
|
---|
3897 | You can now use \c qmake to generate a Makefile for your application.
|
---|
3898 | On the command line, in your project's directory, type the following:
|
---|
3899 |
|
---|
3900 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114
|
---|
3901 |
|
---|
3902 | Then type \c make or \c nmake depending on the compiler you use.
|
---|
3903 |
|
---|
3904 | For Visual Studio users, \c qmake can also generate \c .dsp or
|
---|
3905 | \c .vcproj files, for example:
|
---|
3906 |
|
---|
3907 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115
|
---|
3908 |
|
---|
3909 | \section1 Making an Application Debuggable
|
---|
3910 |
|
---|
3911 | The release version of an application doesn't contain any debugging
|
---|
3912 | symbols or other debugging information. During development it is useful
|
---|
3913 | to produce a debugging version of the application that has the
|
---|
3914 | relevant information. This is easily achieved by adding \c debug to the
|
---|
3915 | \c CONFIG variable in the project file.
|
---|
3916 |
|
---|
3917 | For example:
|
---|
3918 |
|
---|
3919 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116
|
---|
3920 |
|
---|
3921 | Use \c qmake as before to generate a Makefile and you will be able to
|
---|
3922 | obtain useful information about your application when running it in
|
---|
3923 | a debugging environment.
|
---|
3924 |
|
---|
3925 | \section1 Adding Platform-Specific Source Files
|
---|
3926 |
|
---|
3927 | After a few hours of coding, you might have made a start on the
|
---|
3928 | platform-specific part of your application, and decided to keep the
|
---|
3929 | platform-dependent code separate. So you now have two new files to
|
---|
3930 | include into your project file: \c hellowin.cpp and \c
|
---|
3931 | hellounix.cpp. We can't just add these to the \c SOURCES
|
---|
3932 | variable since this will put both files in the Makefile. So, what we
|
---|
3933 | need to do here is to use a scope which will be processed depending on
|
---|
3934 | which platform \c qmake is run on.
|
---|
3935 |
|
---|
3936 | A simple scope that will add in the platform-dependent file for
|
---|
3937 | Windows looks like this:
|
---|
3938 |
|
---|
3939 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117
|
---|
3940 |
|
---|
3941 | So if \c qmake is run on Windows, it will add \c hellowin.cpp to the
|
---|
3942 | list of source files. If \c qmake is run on any other platform, it
|
---|
3943 | will simply ignore it. Now all that is left to be done is to create a
|
---|
3944 | scope for the Unix-specific file.
|
---|
3945 |
|
---|
3946 | When you have done that, your project file should now look
|
---|
3947 | something like this:
|
---|
3948 |
|
---|
3949 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118
|
---|
3950 |
|
---|
3951 | Use \c qmake as before to generate a Makefile.
|
---|
3952 |
|
---|
3953 | \section1 Stopping qmake If a File Doesn't Exist
|
---|
3954 |
|
---|
3955 | You may not want to create a Makefile if a certain file doesn't exist.
|
---|
3956 | We can check if a file exists by using the exists() function. We can
|
---|
3957 | stop \c qmake from processing by using the error() function. This
|
---|
3958 | works in the same way as scopes do. Simply replace the scope condition
|
---|
3959 | with the function. A check for a \c main.cpp file looks like this:
|
---|
3960 |
|
---|
3961 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 119
|
---|
3962 |
|
---|
3963 | The \c{!} symbol is used to negate the test; i.e. \c{exists( main.cpp )}
|
---|
3964 | is true if the file exists, and \c{!exists( main.cpp )} is true if the
|
---|
3965 | file doesn't exist.
|
---|
3966 |
|
---|
3967 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120
|
---|
3968 |
|
---|
3969 | Use \c qmake as before to generate a makefile. If you rename \c
|
---|
3970 | main.cpp temporarily, you will see the message and \c qmake will stop
|
---|
3971 | processing.
|
---|
3972 |
|
---|
3973 | \section1 Checking for More than One Condition
|
---|
3974 |
|
---|
3975 | Suppose you use Windows and you want to be able to see statement
|
---|
3976 | output with qDebug() when you run your application on the command line.
|
---|
3977 | Unless you build your application with the appropriate console setting,
|
---|
3978 | you won't see the output. We can easily put \c console on the \c CONFIG
|
---|
3979 | line so that on Windows the makefile will have this setting. However,
|
---|
3980 | let's say that we only want to add the \c CONFIG line if we are running
|
---|
3981 | on Windows \e and when \c debug is already on the \c CONFIG line.
|
---|
3982 | This requires using two nested scopes; just create one scope, then create
|
---|
3983 | the other inside it. Put the settings to be processed inside the last
|
---|
3984 | scope, like this:
|
---|
3985 |
|
---|
3986 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 121
|
---|
3987 |
|
---|
3988 | Nested scopes can be joined together using colons, so the final
|
---|
3989 | project file looks like this:
|
---|
3990 |
|
---|
3991 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 122
|
---|
3992 |
|
---|
3993 | That's it! You have now completed the tutorial for \c qmake, and are
|
---|
3994 | ready to write project files for your development projects.
|
---|
3995 | */
|
---|
3996 |
|
---|
3997 | /*!
|
---|
3998 | \page qmake-common-projects.html
|
---|
3999 | \title qmake Common Projects
|
---|
4000 | \contentspage {qmake Manual}{Contents}
|
---|
4001 | \previouspage qmake Tutorial
|
---|
4002 | \nextpage Using qmake
|
---|
4003 |
|
---|
4004 | This chapter describes how to set up \c qmake project files for three
|
---|
4005 | common project types that are based on Qt. Although all kinds of
|
---|
4006 | projects use many of the same variables, each of them use project-specific
|
---|
4007 | variables to customize output files.
|
---|
4008 |
|
---|
4009 | Platform-specific variables are not described here; we refer the reader to
|
---|
4010 | the \l{Deploying Qt Applications} document for information on issues such as
|
---|
4011 | \l{Deploying an Application on Mac OS X#Architecture Dependencies}{building
|
---|
4012 | universal binaries for Mac OS X} and
|
---|
4013 | \l{Deploying an Application on Windows#Visual Studio 2005 Onwards}
|
---|
4014 | {handling Visual Studio manifest files}.
|
---|
4015 |
|
---|
4016 | \tableofcontents
|
---|
4017 |
|
---|
4018 | \target Application
|
---|
4019 | \section1 Building an Application
|
---|
4020 |
|
---|
4021 | \section2 The app Template
|
---|
4022 |
|
---|
4023 | The \c app template tells \c qmake to generate a Makefile that will build
|
---|
4024 | an application. With this template, the type of application can be specified
|
---|
4025 | by adding one of the following options to the \c CONFIG variable definition:
|
---|
4026 |
|
---|
4027 | \table
|
---|
4028 | \header \o Option \o Description
|
---|
4029 | \row \o windows \o The application is a Windows GUI application.
|
---|
4030 | \row \o console \o \c app template only: the application is a Windows console
|
---|
4031 | application.
|
---|
4032 | \endtable
|
---|
4033 |
|
---|
4034 | When using this template the following \c qmake system variables are recognized.
|
---|
4035 | You should use these in your .pro file to specify information about your
|
---|
4036 | application.
|
---|
4037 |
|
---|
4038 | \list
|
---|
4039 | \o HEADERS - A list of all the header files for the application.
|
---|
4040 | \o SOURCES - A list of all the source files for the application.
|
---|
4041 | \o FORMS - A list of all the .ui files (created using \c{Qt Designer})
|
---|
4042 | for the application.
|
---|
4043 | \o LEXSOURCES - A list of all the lex source files for the application.
|
---|
4044 | \o YACCSOURCES - A list of all the yacc source files for the application.
|
---|
4045 | \o TARGET - Name of the executable for the application. This defaults
|
---|
4046 | to the name of the project file. (The extension, if any, is added
|
---|
4047 | automatically).
|
---|
4048 | \o DESTDIR - The directory in which the target executable is placed.
|
---|
4049 | \o DEFINES - A list of any additional pre-processor defines needed for the application.
|
---|
4050 | \o INCLUDEPATH - A list of any additional include paths needed for the application.
|
---|
4051 | \o DEPENDPATH - The dependency search path for the application.
|
---|
4052 | \o VPATH - The search path to find supplied files.
|
---|
4053 | \o DEF_FILE - Windows only: A .def file to be linked against for the application.
|
---|
4054 | \o RC_FILE - Windows only: A resource file for the application.
|
---|
4055 | \o RES_FILE - Windows only: A resource file to be linked against for the application.
|
---|
4056 | \endlist
|
---|
4057 |
|
---|
4058 | You only need to use the system variables that you have values for,
|
---|
4059 | for instance, if you don't have any extra INCLUDEPATHs then you don't
|
---|
4060 | need to specify any, \c qmake will add in the default ones needed.
|
---|
4061 | For instance, an example project file might look like this:
|
---|
4062 |
|
---|
4063 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 123
|
---|
4064 |
|
---|
4065 | For items that are single valued, e.g. the template or the destination
|
---|
4066 | directory, we use "="; but for multi-valued items we use "+=" to \e
|
---|
4067 | add to the existing items of that type. Using "=" replaces the item's
|
---|
4068 | value with the new value, for example if we wrote \c{DEFINES=QT_DLL},
|
---|
4069 | all other definitions would be deleted.
|
---|
4070 |
|
---|
4071 | \target Library
|
---|
4072 | \section1 Building a Library
|
---|
4073 |
|
---|
4074 | \section2 The lib Template
|
---|
4075 |
|
---|
4076 | The \c lib template tells \c qmake to generate a Makefile that will
|
---|
4077 | build a library. When using this template, in addition to the system variables
|
---|
4078 | mentioned above for the \c app template the \c VERSION variable is
|
---|
4079 | supported. You should use these in your .pro file to specify
|
---|
4080 | information about the library.
|
---|
4081 |
|
---|
4082 | When using the \c lib template, the following options can be added to the
|
---|
4083 | \c CONFIG variable to determine the type of library that is built:
|
---|
4084 |
|
---|
4085 | \table
|
---|
4086 | \header \o Option \o Description
|
---|
4087 | \row \o dll \o The library is a shared library (dll).
|
---|
4088 | \row \o staticlib \o The library is a static library.
|
---|
4089 | \row \o plugin \o The library is a plugin; this also enables the dll option.
|
---|
4090 | \endtable
|
---|
4091 |
|
---|
4092 | The following option can also be defined to provide additional information about
|
---|
4093 | the library.
|
---|
4094 |
|
---|
4095 | \list
|
---|
4096 | \o VERSION - The version number of the target library, for example, 2.3.1.
|
---|
4097 | \endlist
|
---|
4098 |
|
---|
4099 | The target file name for the library is platform-dependent. For example, on
|
---|
4100 | X11 and Mac OS X, the library name will be prefixed by \c lib; on Windows,
|
---|
4101 | no prefix is added to the file name.
|
---|
4102 |
|
---|
4103 | \target Plugin
|
---|
4104 | \section1 Building a Plugin
|
---|
4105 |
|
---|
4106 | Plugins are built using the \c lib template, as described in the previous
|
---|
4107 | section. This tells \c qmake to generate a Makefile for the project that will
|
---|
4108 | build a plugin in a suitable form for each platform, usually in the form of a
|
---|
4109 | library. As with ordinary libraries, the \c VERSION variable is used to specify
|
---|
4110 | information about the plugin.
|
---|
4111 |
|
---|
4112 | \list
|
---|
4113 | \o VERSION - The version number of the target library, for example, 2.3.1.
|
---|
4114 | \endlist
|
---|
4115 |
|
---|
4116 | \section2 Building a Qt Designer Plugin
|
---|
4117 |
|
---|
4118 | \QD plugins are built using a specific set of configuration settings that
|
---|
4119 | depend on the way Qt was configured for your system. For convenience, these
|
---|
4120 | settings can be enabled by adding \c designer to the project's \c CONFIG
|
---|
4121 | variable. For example:
|
---|
4122 |
|
---|
4123 | \snippet examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro 0
|
---|
4124 |
|
---|
4125 | See the \l{Qt Examples#Qt Designer}{Qt Designer examples} for more
|
---|
4126 | examples of plugin-based projects.
|
---|
4127 |
|
---|
4128 | \section1 Building and Installing in Debug and Release Modes
|
---|
4129 |
|
---|
4130 | Sometimes, it is necessary to build a project in both debug and release
|
---|
4131 | modes. Although the \c CONFIG variable can hold both \c debug and \c release
|
---|
4132 | options, the \c debug option overrides the \c release option.
|
---|
4133 |
|
---|
4134 | \section2 Building in Both Modes
|
---|
4135 |
|
---|
4136 | To enable a project to be built in both modes, you must add the
|
---|
4137 | \c debug_and_release option to your project's \c CONFIG definition:
|
---|
4138 |
|
---|
4139 | \snippet doc/src/snippets/qmake/debug_and_release.pro 0
|
---|
4140 | \snippet doc/src/snippets/qmake/debug_and_release.pro 1
|
---|
4141 |
|
---|
4142 | The scope in the above snippet modifies the build target in each mode to
|
---|
4143 | ensure that the resulting targets have different names. Providing different
|
---|
4144 | names for targets ensures that one will not overwrite the other.
|
---|
4145 |
|
---|
4146 | When \c qmake processes the project file, it will generate a Makefile rule
|
---|
4147 | to allow the project to be built in both modes. This can be invoked in the
|
---|
4148 | following way:
|
---|
4149 |
|
---|
4150 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 124
|
---|
4151 |
|
---|
4152 | The \c build_all option can be added to the \c CONFIG variable in the
|
---|
4153 | project file to ensure that the project is built in both modes by default:
|
---|
4154 |
|
---|
4155 | \snippet doc/src/snippets/qmake/debug_and_release.pro 2
|
---|
4156 |
|
---|
4157 | This allows the Makefile to be processed using the default rule:
|
---|
4158 |
|
---|
4159 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 125
|
---|
4160 |
|
---|
4161 | \section2 Installing in Both Modes
|
---|
4162 |
|
---|
4163 | The \c build_all option also ensures that both versions of the target
|
---|
4164 | will be installed when the installation rule is invoked:
|
---|
4165 |
|
---|
4166 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 126
|
---|
4167 |
|
---|
4168 | It is possible to customize the names of the build targets depending on
|
---|
4169 | the target platform. For example, a library or plugin may be named using a
|
---|
4170 | different convention on Windows to the one used on Unix platforms:
|
---|
4171 |
|
---|
4172 | \omit
|
---|
4173 | Note: This was originally used in the customwidgetplugin.pro file, but is
|
---|
4174 | no longer needed there.
|
---|
4175 | \endomit
|
---|
4176 | \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 127
|
---|
4177 |
|
---|
4178 | The default behavior in the above snippet is to modify the name used for
|
---|
4179 | the build target when building in debug mode. An \c else clause could be
|
---|
4180 | added to the scope to do the same for release mode; left as it is, the
|
---|
4181 | target name remains unmodified.
|
---|
4182 | */
|
---|
4183 |
|
---|