source: trunk/doc/src/development/qmake-manual.qdoc@ 769

Last change on this file since 769 was 769, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

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