1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
|
\chapter qmake Command Reference
\section1 qmake Command Reference
\list
\i \link #About About This Reference \endlink
\i \link #Commands Command Line Options \endlink
\i \link #SystemVariables System Variables \endlink
\i \link #Functions Functions \endlink
\i \link #Properties Properties \endlink
\i \link #Environment Environment Variables and Configuration \endlink
\i \link #Extensions File Extensions \endlink
\i \link #Customizing Customizing Makefile Output \endlink
\endlist
\target About
\section1 About This Reference
This reference is a detailed index of all command line options,
configurations and internal variables used by the cross-platform
makefile generation utility \e qmake.
In addition to the variables and functions described in the following
sections, \e qmake project files may also include comments.
Comments begin with the '#' symbol and run to the end of the line.
\target Commands
\section1 Command Line Options
\section2 Syntax
\code
qmake [options] files
\endcode
\section2 Options
The following options can be specified on the command line to \e qmake:
\list
\i \c -o file \BR
\e qmake output will be directed to \e file. if this argument
is not specified, then \e qmake will try to guess a suitable name. If '-' is
specified, output is directed to stdout.
\i \c -unix \BR
\e qmake will run in unix mode. In this mode, Unix file
naming and path conventions will be used, additionally testing for unix
(as a scope) will succeed. This is the default mode on all Unices.
\i \c -macx \BR
\e qmake will run in Mac OS X mode. In this mode, Unix file
naming and path conventions will be used, additionally testing for macx
(as a scope) will succeed. This is the default mode on Mac OS X.
\i \c -win32 \BR
\e qmake will run in win32 mode. In this mode, Windows file naming and path
conventions will be used, additionally testing for win32 (as a scope) will succeed.
This is the default mode on Windows.
\i \c -d \BR
\e qmake will output (hopefully) useful debugging information.
\i \c -t tmpl \BR
\e qmake will override any set TEMPLATE variables with tmpl, but only
\e after the .pro file has been processed.
\i \c -tp prefix \BR
\e qmake will add the prefix to the TEMPLATE variable.
\i \c -help \BR
\e qmake will go over these features and give some useful help.
\endlist
There are also warning options that can help to find problems in your
project file:
\list
\i \c -Wall \BR
With this \e qmake will turn on all known warnings.
\i \c -Wnone \BR
No warning information will be generated by \e qmake.
\i \c -Wparser \BR
\e qmake will only generate parser warnings, this will alert
you to common pitfalls, and potential problems in the parsing of your .pro
files.
\i \c -Wlogic \BR
Again \e qmake will warn of common pitfalls, and potential problems. This can
include (but not limited to) checking if a file is placed into a list of files
multiple times, if a file cannot be found, etc.
\endlist
\e qmake supports two different modes of operation. The first mode,
which is the default is makefile generation. In this mode, \e qmake
will take a .pro file and turn it into a makefile. Creating makefiles
is covered by this reference guide, there is another mode which
generates .pro files.
To toggle between these modes you must specify in the first argument
what mode you want to use. If no mode is specified, \e qmake will
assume you want makefile mode. The available modes are:
\list
\i \c -makefile \BR
\e qmake output will be a makefile (\link #MakefileMode Makefile mode \endlink).
\i \c -project \BR
\e qmake output will be a project file (\link #ProjectfileMode Project file mode \endlink).
\endlist
\target MakefileMode
\section3 Makefile Mode
In Makefile mode \e qmake will generate a makefile. Additionally you may
supply the following arguments in this mode:
\list
\i \c -after \BR
\e qmake will process assignments given on the commandline after
the specified files.
\i \c -nocache \BR
\e qmake will ignore the .qmake.cache file.
\i \c -nodepend \BR
\e qmake will not generate any dependency information.
\i \c -cache file \BR
\e qmake will use \e file as the cache file, ignoring any other .qmake.cache file found
\i \c -spec spec \BR
\e qmake will use \e spec as a path to platform-compiler information and QMAKESPEC will be ignored.
\endlist
The \c files argument can be a list of one or more project files, separated
by spaces. You may also pass qmake assignments on the command line here and
they will be processed before all files specified, for example:
qmake -makefile -unix -o Makefile "CONFIG+=test" test.pro
If however you are certain you want your variables processed after the
the files specified, then you may pass the -after argument. When this
is specified all assignments on the commandline after the -after
option will be postponed until after the specified files are parsed.
This will generate a Makefile, from test.pro with Unix pathnames. However
many of these arguments aren't necessary as they are the default. Therefore
the line can be simplified on Unix to:
qmake "CONFIG+=test" test.pro
\target ProjectfileMode
\section3 Projectfile Mode
In Projectfile mode \e qmake will generate a project file. Additionally, you may
supply the following arguments in this mode:
\list
\i \c -r \BR
\e qmake will look through supplied directories recursively
\i \c -nopwd \BR
\e qmake will not look in your current working directory for
source code and only use the specified \c files
\endlist
The \c files argument can be a list of files or directories. If a
directory is specified, then it will be included in the \link
#DEPENDPATH DEPENDPATH \endlink variable and relevant code from there
will be included in the generated project file, if a file is given it
will go into the correct variable depending on extension (i.e. .ui
files go into FORMS, .cpp files go into SOURCES, etc). Here too you
may pass assignments on the commandline, when doing so these
assignments will be placed last in the generated .pro file.
\target SystemVariables
\section1 System Variables
\list
\i \link #FrequentlyUsedSystemVariables Frequently Used System Variables \endlink
\i \link #RarelyUsedSystemVariables Rarely Used System Variables \endlink
\endlist
\target FrequentlyUsedSystemVariables
\section2 Frequently Used System Variables
The following variables are recognized by \e qmake and are used
most frequently when creating project files.
\target CONFIG
\section3 CONFIG
The \c CONFIG variable specifies project configuration and
compiler options. The values will be recognized internally by
\e qmake and have special meaning. They are as follows.
These \c CONFIG values control compilation flags:
\list
\i release - Compile with optimization enabled, ignored if
"debug" is specified
\i debug - Compile with debug options enabled
\i warn_on - The compiler should emit more warnings than normally, ignored if
"warn_off" is specified
\i warn_off - The compiler should only emit severe warnings.
\endlist
These options define the application/library type:
\list
\i qt - The target is a TQt application/library and requires the TQt header
files/library. The proper include and library paths for the Qt
library will automatically be added to the project.
\i opengl - The target requires the OpenGL (or Mesa)
headers/libraries. The proper include and library paths for
these libraries will automatically be added to the project.
\i thread - The target is a multi-threaded application or library. The
proper defines and compiler flags will automatically be added to
the project.
\i x11 - The target is a X11 application or library. The proper
include paths and libraries will automatically be added to the
project.
\i windows - The target is a Win32 window application (app only). The
proper include paths,compiler flags and libraries will
automatically be added to the project.
\i console - The target is a Win32 console application (app only). The
proper include paths, compiler flags and libraries will
automatically be added to the
project.
\i dll - The target is a shared object/DLL.The proper
include paths, compiler flags and libraries will automatically be
added to the project.
\i staticlib - The target is a static library (lib only). The proper
compiler flags will automatically be added to the project.
\i plugin - The target is a plugin (lib only). This enables dll as well.
\endlist
These options are used to set the compiler flags:
\list
\i exceptions - Exception support is enabled
\i rtti - RTTI support is enabled
\i stl - STL support is enabled
\endlist
These options define specific things depending on the platform and/or template:
\list
\i flat - When using the vcapp template this will put all the source files into the source group and
the header files into the header group regardless of what directory they reside in. Turning this
option off will group the files within the source/header group depending on the directory they
reside. This is turned on by default.
\endlist
The \c CONFIG variable will also be checked when resolving
scopes. You may assign anything to this variable.
For example:
\code
CONFIG += qt console newstuff
...
newstuff {
SOURCES += new.cpp
HEADERS += new.h
}
\endcode
\target DEFINES
\section3 DEFINES
\e qmake adds the values of this variable as compiler C
preprocessor macros (-D option).
For example:
\code
DEFINES += USE_MY_STUFF QT_DLL
\endcode
\target DEF_FILE
\section3 DEF_FILE
\e {This is only used on Windows when using the 'app' template}.
Specifies a .def file to be included in the project.
\target DESTDIR
\section3 DESTDIR
Specifies where to put the \link #TARGET target \endlink file.
For example:
\code
DESTDIR = ../../lib
\endcode
\target DLLDESTDIR
\section3 DLLDESTDIR
Specifies where to copy the \link #TARGET target \endlink dll.
\target HEADERS
\section3 HEADERS
Defines the header files for the project.
\e qmake will generate dependency information (unless -nodepend
is specified on the \link #Commands command line \endlink) for the
specified headers. \e qmake will also automatically detect if
\e moc is required by the classes in these headers, and add the
appropriate dependencies and files to the project for generating and
linking the moc files.
For example:
\code
HEADERS = myclass.h \
login.h \
mainwindow.h
\endcode
See also \link #SOURCES SOURCES \endlink.
\target INCLUDEPATH
\section3 INCLUDEPATH
This variable specifies the #include directories which should be
searched when compiling the project. Use ';' or a space as the
directory separator.
For example:
\code
INCLUDEPATH = c:\msdev\include d:\stl\include
\endcode
\target FORMS
\section3 FORMS
This variable specifies the .ui files (see \link
designer-manual.book TQt Designer \endlink) to be processed through \e uic
before compiling. All dependencies, headers and source files required
to build these .ui files will automatically be added to the project.
For example:
\code
FORMS = mydialog.ui \
mywidget.ui \
myconfig.ui
\endcode
Note that forms should not be specified using the \c += operator because
this syntax is not fully supported by \QD.
\target LEXSOURCES
\section3 LEXSOURCES
This variable contains a list of lex source files. All
dependencies, headers and source files will automatically be added to
the project for building these lex files.
For example:
\code
LEXSOURCES = lexer.l
\endcode
\target LIBS
\section3 LIBS
This variable contains a list of libraries to be linked into the project.
If you are more comfortable with the Unix convension of -L/-l flags you are
free to use them in a cross-platform manner and qmake will do the correct
thing with these libraries on Windows (namely this means passing the full
path of the library to the linker). The only limitation to this is the
library must exist, for qmake to find which directory a -l lib lives in.
For example:
\code
unix:LIBS += -lmath -L/usr/local/lib
win32:LIBS += c:\mylibs\math.lib
\endcode
\target MOC_DIR
\section3 MOC_DIR
This variable specifies the directory where all intermediate moc
files should be placed.
For example:
\code
unix:MOC_DIR = ../myproject/tmp
win32:MOC_DIR = c:\myproject\tmp
\endcode
\target OBJECTS_DIR
\section3 OBJECTS_DIR
This variable specifies the directory where all intermediate
objects should be placed.
For example:
\code
unix:OBJECTS_DIR = ../myproject/tmp
win32:OBJECTS__DIR = c:\myproject\tmp
\endcode
\target UI_DIR
\section3 UI_DIR
This variable specifies the directory where all intermediate files from uic
should be placed. This variable overrides both UI_SOURCES_DIR and
UI_HEADERS_DIR.
For example:
\code
unix:UI_DIR = ../myproject/ui
win32:UI_DIR = c:\myproject\ui
\endcode
\target UI_HEADERS_DIR
\section3 UI_HEADERS_DIR
This variable specifies the directory where all declaration files (as
generated by uic) should be placed.
For example:
\code
unix:UI_HEADERS_DIR = ../myproject/ui/include
win32:UI_HEADERS_DIR = c:\myproject\ui\include
\endcode
\target UI_SOURCES_DIR
\section3 UI_SOURCES_DIR
This variable specifies the directory where all implementation files (as generated
by uic) should be placed.
For example:
\code
unix:UI_SOURCES_DIR = ../myproject/ui/src
win32:UI_SOURCES_DIR = c:\myproject\ui\src
\endcode
\target REQUIRES
\section3 REQUIRES
This is a special variable processed by \e qmake. If the
contents of this variable do not appear in CONFIG by the time this
variable is assigned, then a minimal makefile will be generated that
states what dependencies (the values assigned to REQUIRES) are
missing.
This is mainly used in Qt's build system for building the examples.
\target SOURCES
\section3 SOURCES
This variable contains the name of all source files in the project.
For example:
\code
SOURCES = myclass.cpp \
login.cpp \
mainwindow.cpp
\endcode
See also \link #HEADERS HEADERS \endlink
\section3 SUBDIRS
This variable, when used with the 'subdirs'
\link #TEMPLATE TEMPLATE \endlink contains the names of all subdirectories
to look for a project file.
For example:
\code
SUBDIRS = kernel \
tools
\endcode
\target TARGET
\section3 TARGET
This specifies the name of the target file.
For example:
\code
TEMPLATE = app
TARGET = myapp
SOURCES = main.cpp
\endcode
The project file above would produce an executable named 'myapp' on
unix and 'myapp.exe' on windows.
\target TEMPLATE
\section3 TEMPLATE
This variable contains the name of the template to use when
generating the project. The allowed values are:
\list
\i app - Creates a makefile for building applications (the default)
\i lib - Creates a makefile for building libraries
\i subdirs - Creates a makefile for building targets in subdirectories
\i vcapp - \e {win32 only} Creates an application project file for
Visual Studio
\i vclib - \e {win32 only} Creates a library project file for Visual
Studio
\endlist
For example:
\code
TEMPLATE = lib
SOURCES = main.cpp
TARGET = mylib
\endcode
The template can be overridden by specifying a new template type with the
\c -t command line option. This overrides the template type \e after the .pro
file has been processed. With .pro files that use the template type to
determine how the project is built, it is necessary to declare TEMPLATE on
the command line rather than use the \c -t option.
\section3 VERSION
This variable contains the version number of the library if the
'lib' \link #TEMPLATE TEMPLATE \endlink is specified.
For example:
\code
VERSION = 1.2.3
\endcode
\section3 DISTFILES
This variable contains a list of files to be included in the dist
target. This feature is supported by UnixMake specs only.
For example:
\code
DISTFILES += ../program.txt
\endcode
\target YACCSOURCES
\section3 YACCSOURCES
This variable contains a list of yacc source files to be included
in the project. All dependencies, headers and source files will
automatically be included in the project.
For example:
\code
YACCSOURCES = moc.y
\endcode
\target RarelyUsedSystemVariables
\section2 Rarely Used System Variables
The following variables are also recognized by \e qmake but are
either internal or very rarely used.
\target DESTDIR_TARGET
\section3 DESTDIR_TARGET
This variable is set internally by \e qmake, which is basically the DESTDIR variable with
the TARGET variable appened at the end. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\target DSP_TEMPLATE
\section3 DSP_TEMPLATE
This variable is set internally by \e qmake, which specifies where the dsp template file for
basing generated dsp files is stored. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\target LEXIMPLS
\section3 LEXIMPLS
This variable contains a list of lex implementation files. The value
of this variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely
needs to be modified.
\target LEXOBJECTS
\section3 LEXOBJECTS
This variable contains the names of intermediate lex object
files.The value of this variable is typically handled by
\e qmake and rarely needs to be modified.
\target LITERAL_HASH
\section3 LITERAL_HASH
This variable is used whenever a literal hash character (\c{#}) is needed in
a variable declaration, perhaps as part of a file name or in a string passed
to some external application.
For example:
\code
# To include a literal hash character, use the $$LITERAL_HASH variable:
urlPieces = http://doc.trolltech.com/3.3/qmake-manual-8.html LITERAL_HASH
message($$join(urlPieces, $$LITERAL_HASH))
\endcode
By using \c LITERAL_HASH in this way, the \c # character can be used
to construct a URL for the \c message() function to print to the console.
\target MAKEFILE
\section3 MAKEFILE
This variable specifies the name of the makefile which
\e qmake should use when outputting the dependency information
for building a project. The value of this variable is typically
handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target MAKEFILE_GENERATOR
\section3 MAKEFILE_GENERATOR
This variable contains the name of the makefile generator to use
when generating a makefile. The value of this variable is typically
handled internally by \e qmake and rarely needs to be modified.
\target OBJECTS
\section3 OBJECTS
This variable is generated from the \link #SOURCES SOURCES
\endlink variable. The extension of each source file will have been
replaced by .o (Unix) or .obj (Win32). The value of this variable is
typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and
rarely needs to be modified.
\target OBJMOC
\section3 OBJMOC
This variable is set by \e qmake if files can be found that
contain the TQ_OBJECT macro. \c OBJMOC contains the
name of all intermediate moc object files. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\target PRECOMPILED_HEADER
\section3 PRECOMPILED_HEADER
This variable indicates the header file for creating a precompiled
header file, to increase the compilation speed of a project.
Precompiled headers are currently only supported on some platforms
(Windows - all MSVC project types, Mac OS X - Xcode, Makefile,
UNIX - gcc 3.3 and up).
On other platforms, this variable has different meaning, as noted
below.
This variable contains a list of header files that require some
sort of pre-compilation step (such as with moc). The value of this
variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\target QMAKE
\section3 QMAKE
This variable contains the name of the \e qmake program
itself and is placed in generated makefiles. The value of this
variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\target QMAKESPEC_systemvariable
\section3 QMAKESPEC
This variable contains the name of the \e qmake
configuration to use when generating makefiles. The value of this
variable is typically handled by \e qmake and rarely needs to be modified.
Use the \link #QMAKESPEC QMAKESPEC \endlink environment variable instead.
\target QMAKE_APP_FLAG
\section3 QMAKE_APP_FLAG
This variable is empty unless the 'app'
\link #TEMPLATE TEMPLATE \endlink is specified. The value of this
variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified. Use the following instead:
\code
app {
#conditional code for 'app' template here
}
\endcode
\target QMAKE_APP_OR_DLL
\section3 QMAKE_APP_OR_DLL
This variable is empty unless the 'app' or 'dll'
\link #TEMPLATE TEMPLATE \endlink is specified. The value of this
variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\target QMAKE_AR_CMD
\section3 QMAKE_AR_CMD
\e {This is used on Unix platforms only}
This variable contains the command for invoking the program which
creates, modifies and extracts archives. The value of this variable is
typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink
and rarely needs to be modified.
\target QMAKE_CFLAGS_DEBUG
\section3 QMAKE_CFLAGS_DEBUG
This variable contains the flags for the C compiler in debug mode.The value of this variable is
typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink
and rarely needs to be modified.
\target QMAKE_CFLAGS_MT
\section3 QMAKE_CFLAGS_MT
This variable contains the compiler flags for creating a
multi-threaded application or when the version of TQt that you link
against is a multi-threaded statically linked library. The value of
this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_CFLAGS_MT_DBG
\section3 QMAKE_CFLAGS_MT_DBG
This variable contains the compiler flags for creating a debuggable
multi-threaded application or when the version of TQt that you link
against is a debuggable multi-threaded statically linked library. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_CFLAGS_MT_DLL
\section3 QMAKE_CFLAGS_MT_DLL
\e {This is used on Windows only}
This variable contains the compiler flags for creating a
multi-threaded dll or when the version of TQt that you link
against is a multi-threaded dll. The value of this variable is typically
handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and
rarely needs to be modified.
\target QMAKE_CFLAGS_MT_DLLDBG
\section3 QMAKE_CFLAGS_MT_DLLDBG
\e {This is used on Windows only}
This variable contains the compiler flags for creating a debuggable
multi-threaded dll or when the version of TQt that you link
against is a debuggable multi-threaded statically linked library.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_CFLAGS_RELEASE
\section3 QMAKE_CFLAGS_RELEASE
This variable contains the compiler flags for creating a non-debuggable
application. The value of this variable is typically
handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and
rarely needs to be modified.
\target QMAKE_CFLAGS_SHLIB
\section3 QMAKE_CFLAGS_SHLIB
\e {This is used on Unix platforms only}
This variable contains the compiler flags for creating a shared
library. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CFLAGS_THREAD
\section3 QMAKE_CFLAGS_THREAD
This variable contains the compiler flags for creating a multi-threaded
application. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CFLAGS_WARN_OFF
\section3 QMAKE_CFLAGS_WARN_OFF
This variable is not empty if the warn_off
\link #TEMPLATE TEMPLATE \endlink option is specified. The value of this
variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink
and rarely needs to be modified.
\target QMAKE_CFLAGS_WARN_ON
\section3 QMAKE_CFLAGS_WARN_ON
This variable is not empty if the warn_on
\link #TEMPLATE TEMPLATE \endlink option is specified.
The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CLEAN
\section3 QMAKE_CLEAN
This variable contains any files which are not generated files (such as moc and uic
generated files) and object files that should be removed when using "make clean".
\target QMAKE_CXXFLAGS_DEBUG
\section3 QMAKE_CXXFLAGS_DEBUG
This variable contains the C++ compiler flags for creating a debuggable
application. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_MT
\section3 QMAKE_CXXFLAGS_MT
This variable contains the C++ compiler flags for creating a multi-threaded
application. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_MT_DBG
\section3 QMAKE_CXXFLAGS_MT_DBG
This variable contains the C++ compiler flags for creating a debuggable multi-threaded
application. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_MT_DLL
\section3 QMAKE_CXXFLAGS_MT_DLL
\c {This is used on Windows only}
This variable contains the C++ compiler flags for creating a multi-threaded
dll. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_MT_DLLDBG
\section3 QMAKE_CXXFLAGS_MT_DLLDBG
\c {This is used on Windows only}
This variable contains the C++ compiler flags for creating a multi-threaded debuggable
dll. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_RELEASE
\section3 QMAKE_CXXFLAGS_RELEASE
This variable contains the C++ compiler flags for creating an
application. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_SHLIB
\section3 QMAKE_CXXFLAGS_SHLIB
This variable contains the C++ compiler flags for creating a
shared library. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_THREAD
\section3 QMAKE_CXXFLAGS_THREAD
This variable contains the C++ compiler flags for creating a
multi-threaded application. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs
to be modified.
\target QMAKE_CXXFLAGS_WARN_OFF
\section3 QMAKE_CXXFLAGS_WARN_OFF
This variable contains the C++ compiler flags for suppressing compiler warnings.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_CXXFLAGS_WARN_ON
\section3 QMAKE_CXXFLAGS_WARN_ON
This variable contains C++ compiler flags for generating compiler warnings.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_EXTENSION_SHLIB
\section3 QMAKE_EXTENSION_SHLIB
This variable contains the extention for shared libraries. The value of this
variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink
and rarely needs to be modified.
\target QMAKE_FAILED_REQUIREMENTS
\section3 QMAKE_FAILED_REQUIREMENTS
This variable contains the list of requirements that were failed to be met when
\e qmake was used. For example, the sql module is needed and wasn't compiled into Qt. The
value of this variable is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink
and rarely needs to be modified.
\target QMAKE_FILETAGS
\section3 QMAKE_FILETAGS
This variable contains the file tags needed to be entered into the makefile, such as SOURCES
and HEADERS. The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_INCDIR
\section3 QMAKE_INCDIR
This variable contains the location of all known header files to be added to
INCLUDEPATH when building an application. The value of this variable is
typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely
needs to be modified.
\target POST_TARGETDEPS
\section3 POST_TARGETDEPS
All libraries that the \link #TARGET target \endlink depends on can be
listed in this variable. Some backends do not support this, these include
MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is support
internally by these build tools, this is usefull for explicitly listing
dependant static libraries.
This list will go after all builtin (and \link #PRE_TARGETDEPS
$$PRE_TARGETDEPS \endlink) dependencies.
\target PRE_TARGETDEPS
\section3 PRE_TARGETDEPS
All libraries that the \link #TARGET target \endlink depends on can be
listed in this variable. Some backends do not support this, these include
MSVC Dsp, and ProjectBuilder .pbproj files. Generally this is support
internally by these build tools, this is usefull for explicitly listing
dependant static libraries.
This list will go before all builtin dependencies.
\target QMAKE_INCDIR_OPENGL
\section3 QMAKE_INCDIR_OPENGL
This variable contains the location of OpenGL header files to be added
to INCLUDEPATH when building an application with OpenGL support. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_INCDIR_TQT
\section3 QMAKE_INCDIR_TQT
This variable contains the location of all known header file
paths to be added to INCLUDEPATH when building a TQt application. The value
of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_INCDIR_THREAD
\section3 QMAKE_INCDIR_THREAD
This variable contains the location of all known header file
paths to be added to INCLUDEPATH when building a multi-threaded application.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_INCDIR_X11
\section3 QMAKE_INCDIR_X11
\e {This is used on Unix platforms only}
This variable contains the location of X11 header file paths to be
added to INCLUDEPATH when building a X11 application. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target QMAKE_LFLAGS_CONSOLE
\section3 QMAKE_LFLAGS_CONSOLE
\e {This is used on Windows only}
This variable contains link flags when building console
programs. The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_CONSOLE_DLL
\e {This is used on Windows only}
This variable contains link flags when building console
dlls. The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_DEBUG
This variable contains link flags when building debuggable applications. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_PLUGIN
This variable contains link flags when building plugins. The value
of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_QT_DLL
This variable contains link flags when building programs that
use the TQt library built as a dll. The value of this variable is
typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_RELEASE
This variable contains link flags when building applications for
release. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_SHAPP
This variable contains link flags when building applications which are using
the 'app' template. The value of this variable is typically handled by
\e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_SHLIB
This variable contains link flags when building shared libraries
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_SONAME
This variable specifies the link flags to set the name of shared objects,
such as .so or .dll. The value of this variable is typically handled by \e
qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_THREAD
This variable contains link flags when building multi-threaded projects.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_WINDOWS
\e {This is used on Windows only}
This variable contains link flags when building windows projects.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LFLAGS_WINDOWS_DLL
\e {This is used on Windows only}
This variable contains link flags when building windows dll projects.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBDIR
This variable contains the location of all known library
directories.The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBDIR_FLAGS
\e {This is used on Unix platforms only}
This variable contains the location of all library
directory with -L prefixed. The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 VPATH
This variable tells \e qmake where to search for files it cannot
open. With this you may tell \e qmake where it may look for things
like SOURCES, and if it finds an entry in SOURCES that cannot be
opened it will look through the entire VPATH list to see if it can
find the file on its own.
See also \link #DEPENDPATH DEPENDPATH \endlink.
\target DEPENDPATH
\section3 DEPENDPATH
This variable contains the list of all directories to look in to
resolve dependencies. This will be used when crawling through
'included' files.
\section3 QMAKE_LIBDIR_OPENGL
This variable contains the location of the OpenGL library
directory.The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBDIR_TQT
This variable contains the location of the TQt library
directory.The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBDIR_X11
\e {This is used on Unix platforms only}
This variable contains the location of the X11 library
directory.The value of this variable is typically handled by
\e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS
This variable contains all project libraries. The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_CONSOLE
\e {This is used on Windows only}
This variable contains all project libraries that should be linked against
when building a console application. The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_OPENGL
This variable contains all OpenGL libraries. The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_OPENGL_QT
This variable contains all OpenGL TQt libraries.The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_QT
This variable contains all TQt libraries.The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_QT_DLL
\e {This is used on Windows only}
This variable contains all TQt libraries when TQt is built as a dll. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_QT_OPENGL
This variable contains all the libraries needed to link against if
OpenGL support is turned on. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_QT_THREAD
This variable contains all the libraries needed to link against if
thread support is turned on. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_RT
\e {This is used with Borland compilers only}
This variable contains the runtime library needed to link against when
building an application. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_RTMT
\e {This is used with Borland compilers only}
This variable contains the runtime library needed to link against when
building a multi-threaded application. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_THREAD
\e {This is used on Unix platforms only}
This variable contains all libraries that need to be linked against
when building a multi-threaded application. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_WINDOWS
\e {This is used on Windows only}
This variable contains all windows libraries.The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_X11
\e {This is used on Unix platforms only}
This variable contains all X11 libraries.The value of this
variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIBS_X11SM
\e {This is used on Unix platforms only}
This variable contains all X11 session management libraries. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LIB_FLAG
This variable is not empty if the 'lib' template is specified. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_LINK_SHLIB_CMD
This variable contains the command to execute when creating a
shared library. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_POST_LINK
This variable contains the command to execute after linking the TARGET
together. This variable is normally empty and therefore nothing is
executed, additionally some backends will not support this - mostly only
Makefile backends.
\section3 QMAKE_PRE_LINK
This variable contains the command to execute before linking the TARGET
together. This variable is normally empty and therefore nothing is
executed, additionally some backends will not support this - mostly only
Makefile backends.
\section3 QMAKE_LN_SHLIB
This variable contains the command to execute when creating a link
to a shared library. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_MAKEFILE
This variable contains the name of the makefile to create. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_MOC_SRC
This variable contains the names of all moc source files to
generate and include in the project. The value of this variable is
typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_QMAKE
This variable contains the location of qmake if it is not in the path.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_QT_DLL
This variable is not empty if TQt was built as a dll. The
value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_RUN_CC
This variable specifies the individual rule needed to build an object.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_RUN_CC_IMP
This variable specifies the individual rule needed to build an object.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_RUN_CXX
This variable specifies the individual rule needed to build an object.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_RUN_CXX_IMP
This variable specifies the individual rule needed to build an object.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_TARGET
This variable contains the name of the project target. The value of
this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 QMAKE_UIC
This variable contains the location of uic if it is not in the path.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
It can be used to specify arguments to uic as well, such as additional plugin
paths. For example:
\code
QMAKE_UIC = uic -L /path/to/plugin
\endcode
\section3 RC_FILE
This variable contains the name of the resource file for the application.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 RES_FILE
This variable contains the name of the resource file for the application.
The value of this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 SRCMOC
This variable is set by \e qmake if files can be found that
contain the TQ_OBJECT macro. \c SRCMOC contains the
name of all the generated moc files. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\section3 TARGET_EXT
This variable specifies the target's extension. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\section3 TARGET_x
This variable specifies the target's extension with a major version number. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\section3 TARGET_x.y.z
This variable specifies the target's extension with version number. The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\section3 UICIMPLS
This variable contains a list of the generated implementation files by UIC.
The value of this variable
is typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and rarely needs to be
modified.
\section3 UICOBJECTS
This variable is generated from the UICIMPLS variable. The extension of each
file will have been replaced by .o (Unix) or .obj (Win32). The value of this variable is
typically handled by \e qmake or \link #QMAKESPEC qmake.conf \endlink and
rarely needs to be modified.
\section3 VER_MAJ
This variable contains the major version number of the library, if the
'lib' \link #TEMPLATE template \endlink is specified.
\section3 VER_MIN
This variable contains the minor version number of the library, if the
'lib' \link #TEMPLATE template \endlink is specified.
\section3 VER_PAT
This variable contains the patch version number of the library, if the
'lib' \link #TEMPLATE template \endlink is specified.
\section3 QMAKE_EXT_MOC
This variable changes the extention used on included moc files.
See also \link #Extensions File Extensions \endlink.
\section3 QMAKE_EXT_UI
This variable changes the extention used on /e Designer UI files.
See also \link #Extensions File Extensions \endlink.
\section3 QMAKE_EXT_PRL
This variable changes the extention used on created PRL files.
See also \link #Extensions File Extensions \endlink,
\link #LibDepend Library Dependencies \endlink.
\section3 QMAKE_EXT_LEX
This variable changes the extention used on files given to lex.
See also \link #Extensions File Extensions \endlink,
\link #LEXSOURCES LEXSOURCES \endlink.
\section3 QMAKE_EXT_YACC
This variable changes the extention used on files given to yacc.
See also \link #Extensions File Extensions \endlink,
\link #LEXSOURCES YACCSOURCES \endlink.
\section3 QMAKE_EXT_OBJ
This variable changes the extention used on generated object files.
See also \link #Extensions File Extensions \endlink.
\section3 QMAKE_EXT_CPP
This variable changes the interpretation of all suffixes in this
list of values as files of type C++ source code.
See also \link #Extensions File Extensions \endlink.
\section3 QMAKE_EXT_H
This variable changes the interpretation of all suffixes in this
list of values as files of type C header files.
See also \link #Extensions File Extensions \endlink.
\section3 YACCIMPLS
This variable contains a list of yacc source files. The value of
this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\section3 YACCOBJECTS
This variable contains a list of yacc object files. The value of
this variable is typically handled by \e qmake or
\link #QMAKESPEC qmake.conf \endlink and rarely needs to be modified.
\target Functions
\section1 Functions
\e qmake recognizes the following functions:
\section2 include( filename )
This function will include the contents of \e filename into the
current project at the point where was included. The function succeeds
if \e filename was included, otherwise it fails. You can check the
return value of this function using a
scope.
For example:
\code
include( shared.pri )
OPTIONS = standard custom
!include( options.pri ) {
message( "No custom build options specified" )
OPTIONS -= custom
}
\endcode
\section2 exists( file )
This function will test if \e file exists. If the file exists, then it will succeed; otherwise it will
fail.
You can specify a regular expression in file and it will succeed if any file
matches the regular expression specified.
For example:
\code
exists( $(TQTDIR)/lib/libtqt-mt* ) {
message( "Configuring for multi-threaded Qt..." )
CONFIG += thread
}
\endcode
\section2 contains( variablename, value )
This function will succeed if the variable \e variablename
contains the value \e value. You can check the return value of this
function using a scope.
For example:
\code
contains( drivers, network ) {
# drivers contains 'network'
message( "Configuring for network build..." )
HEADERS += network.h
SOURCES += network.cpp
}
\endcode
\section2 count( variablename, number )
This function will succeed if the variable \e variablename
contains \e number elements, otherwise it will fail. You can check
the return value of this function using a
scope.
For example:
\code
MYVAR = one two three
count( MYVAR, 3 ) {
# always true
}
\endcode
\section2 infile( filename, var, val )
This function will succeed if the file \e filename (when parsed
by qmake itself) contains the variable \e var with a value of
\e val. You may also not pass in a third argument (\e val) and the
function will only test if \e var has been assigned to in the file.
\section2 isEmpty( variablename )
This function will succeed if the variable \e variablename is
empty (same as \c count(variable, 0)).
\section2 system( command )
This function will execute \c command in a secondary shell and will
succeed if the command exits with an exit status of 1. You can check the
return value of this function using a scope.
For example:
\code
system(ls /bin):HAS_BIN=FALSE
\endcode
\section2 message( string )
This function will always succeed, and will display the given
\e string to the user.
\section2 error( string )
This function will never return a value. It will display the given \e
string to the user, and then exit \e qmake. This function should
only be used for very fatal configurations.
For example:
\code
release:debug:error(You can't have release and debug at the same time!)
\endcode
\target Properties
\section1 Properties
\e qmake has a system of persistant information, this allows you to
'set' a variable in qmake once, and each time qmake is invoked this
value can be queried. Use the following to set a property in qmake:
\code
qmake -set VARIABLE VALUE
\endcode
To retrieve this information back from qmake you can do:
\code
qmake -query VARIABLE
qmake -query #queries all current VARIABLE/VALUE pairs..
\endcode
This information will be saved into a TQSettings object (meaning it
will be stored in different places for different platforms). As
VARIABLE is versioned as well, you can set one value in an older
version of qmake, and newer versions will retrieve this value, however
if you -set VARIABLE into a newer version of qmake the older version
will not use this value. You can however query a specific version of a
variable if you prefix that version of qmake to VARIABLE, as in:
\code
qmake -query "1.06a/VARIABLE"
\endcode
qmake also has the notion of 'builtin' properties, for example you can
query the installation of TQt for this version of qmake with the
QT_INSTALL_PREFIX property:
\code
qmake -query "QT_INSTALL_PREFIX"
\endcode
These builtin properties cannot have a version prefixed to them as
they are not versioned and each qmake will have its own notion of
these values. The list below outlines the builtin properties:
\list
\i QT_INSTALL_PREFIX - Where the version of TQt this qmake is built for resides
\i QT_INSTALL_DATA - Where data for this version of TQt resides
\i QMAKE_VERSION - The current version of qmake
\endlist
Finally, these values can be queried in a project file with a special
notation such as:
\code
QMAKE_VERS = $$[QMAKE_VERSION]
\endcode
\target Environment
\section1 Environment Variables and Configuration
\target QMAKESPEC
\section2 QMAKESPEC
\e qmake requires a platform and compiler description file which
contains many default values used to generate appropriate makefiles.
The standard TQt distribution comes with many of these files, located
in the 'mkspecs' subdirectory of the TQt installation.
The QMAKESPEC environment variable can contain any of the following:
\list
\i A complete path to a directory containing a qmake.conf file. In this case \e qmake will open the qmake.conf file from within that directory. If the file does not exist, \e qmake will exit with an error.
\i The name of a platform-compiler combination. In this case, \e qmake will search in the directory specified by the TQTDIR environment variable.
\endlist
Note: the QMAKESPEC path will automatically be added to the
\link #INCLUDEPATH INCLUDEPATH \endlink system variable.
\target INSTALLS
\section2 INSTALLS
It is common on UNIX to be able to install from the same utility as
you build with (e.g make install). For this \e qmake has introduce the
concept of an install set. The notation for this is quite simple,
first you fill in an "object" in qmake for example:
\code
documentation.path = /usr/local/program/doc
documentation.files = docs/*
\endcode
In this way you are telling \e qmake several things about this
install, first that you plan to install to /usr/local/program/doc (the
path member), second that you plan to copy everything in the docs
directory. Once this is done you may insert it in the install list:
\code
INSTALLS += documentation
\endcode
Now \e qmake will take over making sure the correct things are copied
to the specified places. If however you require greater control you
may use the 'extra' member of the object:
\code
unix:documentation.extra = create_docs; mv master.doc toc.doc
\endcode
Then qmake will run the things in extra (this is of course platform
specific, so you may need to test for your platform first, this case
we test for unix). Then it will do the normal processings of the files
member. Finally if you appened a builtin install to INSTALLS \e qmake
(and do not specify a files or extra member) will decide what needs to
be copied for you, currently the only supported builtin is target:
\code
target.path = /usr/local/myprogram
INSTALLS += target
\endcode
With this \e qmake will know what you plan need copied, and do this
for you.
\target cache
\section2 Cache File
The cache file (mentioned above in the options) is a special file \e qmake
will read to find settings not specified in the \c qmake.conf file, the
.pro file, or the command line. If \c -nocache is not specified, \e qmake
will try to find a file called \c .qmake.cache in parent directories. If
it fails to find this file, it will silently ignore this step of
processing.
\target LibDepend
\section2 Library Dependencies
Often when linking against a library \e qmake relies on the underlying
platform to know what other libraries this library links against, and
lets the platform pull them in. In many cases, however, this is not
sufficent. For example when statically linking a library there are no
libraries linked against, and therefore no dependencies to those
libraries are created - however an application that later links
against this library will need to know where to find the symbols that
the linked in library will require. To help with this situation \e
qmake will follow a library's dependencies when it feels appropriate,
however this behaviour must be enabled in \e qmake. To enable requires
two steps. First, you must enable it in the library - to do this you
must tell \e qmake to save information about this library:
\code
CONFIG += create_prl
\endcode
This is only relevant to the lib template, and will be ignored for all
others. When this option is enabled \e qmake will create a file
(called a .prl file) which will save some meta information about the
library. This metafile is itself just a qmake project file, but with
all internal variables. You are free to view this file, and if deleted
\e qmake will know to recreate it when necesary (either when the .pro
file is later read, or if a dependent library (described below) has
changed). When installing this library (by using target in INSTALLS,
above) \e qmake will automatically copy the .prl file to your install
path.
The second step to enabling this processing is to turn on reading of
the meta information created above:
\code
CONFIG += link_prl
\endcode
When this is turned on \e qmake will process all libraries linked to,
and find their meta information. With this meta information \e qmake
will figure out what is relevant to linking, specifically it will add
to your list of DEFINES as well as LIBS. Once \e qmake has processed
this file, it will then look through the newly introduced LIBS and
find their dependent .prl files, and continue until all libraries have
been resolved. At this point the makefile is created as usual, and the
libraries are linked explicity against your program.
The internals of the .prl file are left closed so they can easily
change later. It is not designed to be changed by hand however, and
should only be created by \e qmake - these .prl files should also not
be transfered from operating system to operating system as they may be
platform dependent (like a makefile).
\target Extensions
\section2 File Extensions
Under normal circumstances \e qmake will try to use appropriate file extensions
for your platform. There may be times, however, that you would like to override
the behavior of these extensions. To do this, you must modify builtin variables
in your .pro file, which will in turn changes \e qmake's interpretation of these
files. You may do this as:
\code
QMAKE_EXT_MOC = .mymoc
\endcode
The variables are as follows:
\list
\i QMAKE_EXT_MOC - This modifies the extension placed on included moc files.
\i QMAKE_EXT_UI - This modifies the extension used for designer UI files (usually in FORMS).
\i QMAKE_EXT_PRL - This modifies the extension placed on
\link #LibDepend library dependency files \endlink.
\i QMAKE_EXT_LEX - This changes the suffix used in files (usually in LEXSOURCES).
\i QMAKE_EXT_YACC - This changes the suffix used in files (usually in YACCSOURCES).
\i QMAKE_EXT_OBJ - This changes the suffix used on generated object files.
\endlist
All the above accept just the first value, so you must assign to it one value that
will be used through your makefile. There are two variables that accept a list of values,
they are:
\list
\i QMAKE_EXT_CPP - Changes interpretation all files with these suffixes to be
C++ source files.
\i QMAKE_EXT_H - Changes interpretation all files with these suffixes to be
C header files.
\endlist
\target Customizing
\section2 Customizing Makefile Output
qmake often tries to be all things to all build tools, this is often less
than ideal when you really need to run special platform dependent
commands. This can be achieved with specific instructions to the different
qmake backends (currently this is only supported by the UNIX \link
#MAKEFILE_GENERATOR generator \endlink).
The interfaces to customizing the Makefile are done through "objects" as in
other places in qmake. The notation for this is quite simple, first you
fill in an "object" in qmake for example:
\code
mytarget.target = .buildfile
mytarget.commands = touch $$mytarget.target
mytarget.depends = mytarget2
mytarget2.commands = @echo Building $$mytarget.target
\endcode
The information above defines a qmake target called mytarget which contains
a Makefile target called .buildfile, .buildfile is generated by 'touch
.buildfile', and finally that this Makefile target depends on the qmake
target mytarget2. Additionally we've defined the qmake target mytarget2
which simply echo's something to stdout.
The final step to making use of the above is to instruct qmake that this is
actually an object used by the target building parts of qmake by:
\code
QMAKE_EXTRA_UNIX_TARGETS += mytarget mytarget2
\endcode
This is all you need to do to actually build custom targets in qmake, of
course you may want to tie one of these targets to actually building the
\link #TARGET qmake build target \endlink. To do this, you simply need to
include your Makefile target in the list of \link #PRE_TARGETDEPS PRE_TARGETDEPS
\endlink.
For convenience there is also a method of customizing (UNIX) projects
for generic new compilers (or even preprocessors).
\code
new_moc.output = moc_${QMAKE_FILE_BASE}.cpp
new_moc.commands = moc ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT}
new_moc.depends = g++ -E -M ${QMAKE_FILE_NAME} | sed "s,^.*: ,,"
new_moc.input = NEW_HEADERS
QMAKE_EXTRA_UNIX_COMPILERS += new_moc
\endcode
With this you can create a new moc for qmake, the commands will be
executed over all arguments given to a NEW_HEADERS variable (from the
input variable), and write to output (and automatically hand this
filename to the compiler to be linked into your target). Additionally
qmake will execute depends to generate dependency information and
place this in the project as well.
These commands can easily be placed into a cache file, and subsequent
.pro files can give several arguments to NEW_HEADERS.
|