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

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

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

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