qmake 3.1 (Qt 5.14.0 use) User's Manual 9-- configuration qmake

table of Contents

 

Attributes

QMAKESPEC

Cache files

File name extension


Attributes

Qmake have a system for permanent configuration, the system allows you to set the property qmake once, and be queried at each qmake call. You can set properties qmake, as follows:

  qmake -set PROPERTY VALUE

The appropriate attributes and values, and should be replaced PROPERTY VALUE.

You can retrieve the following information from qmake:

  qmake -query PROPERTY
  qmake -query #queries all current PROPERTY/VALUE pairs

Note: In addition to using qmake -set PROPERTY VALUE attribute set outside, qmake -query built-in properties are also listed.

This information will be saved to QSettings object (meaning it will be stored in different locations on different platforms).

The following list summarizes built-in attributes:

QMAKE_SPEC - QMAKESPEC parsed and stored in the host variable during the build host mkspec abbreviation
QMAKE_VERSION - the current version of qmake
QMAKE_XSPEC - an abbreviation of the goal mkspec, parsed and stored in QMAKESPEC variable during the build target
QT_HOST_BINS - Host executable file position
QT_HOST_DATA - qmake location of the host data using the executable file
QT_HOST_PREFIX - all hosts default prefix paths
QT_INSTALL_ARCHDATA - Qt data depends on the general architecture of a position
QT_INSTALL_BINS - position binary Qt (tools and applications)
QT_INSTALL_CONFIGURATION - Qt set location. On Windows NA
QT_INSTALL_DATA - position in the regular Qt data independent of the architecture
QT_INSTALL_DOCS - document location
QT_INSTALL_EXAMPLES - example location
QT_INSTALL_HEADERS - the location of all header files
QT_INSTALL_IMPORTS - QML 1.x extended position
required at run-time library - QT_INSTALL_LIBEXECS location of the executable file of the
location of the library - QT_INSTALL_LIBS
QT_INSTALL_PLUGINS - Qt plug-in position of
QT_INSTALL_PREFIX - default prefix of all paths
QT_INSTALL_QML - QML 2.x extended position
QT_INSTALL_TESTS - Qt test location
QT_INSTALL_TRANSLATIONS - location translated information Qt string
QT_SYSROOT - target environment used to build sysroot
QT_VERSION - Qt version. We recommend that you instead use $$ QT. <Module> .version variable query Qt module-specific version number.

For example, you can use QT_INSTALL_PREFIX attribute query the version of Qt installation qmake:

  qmake -query "QT_INSTALL_PREFIX"

You can query property values ​​in the project file in the following manner:

  QMAKE_VERS = $$[QMAKE_VERSION]

QMAKESPEC

qmake requires a platform and compiler description file, which contains many Makefile for generating the appropriate default values. Many of these files are files with standard Qt release, these files are located in subdirectories mkspecs Qt installation.

QMAKESPEC environment variable may contain any of the following:

  • It contains the full path to the directory qmake.conf file. In this case, qmake open qmake.conf file from that directory. If the file does not exist, qmake exits with an error.
  • The name of the compiler combination of platform. In this case, qmake will mkspecs subdirectory specified when compiling Qt data path of the directory specified search (See QLibraryInfo :: DataPath).

Note: QMAKESPEC Makefile path is automatically added to the contents generated after INCLUDEPATH system variables.

Cache files

Cache file is a special file qmake read, to look not specified in qmake.conf files, project files, or command line settings. When you run qmake, unless specified -nocache, otherwise it will look for a file named .qmake.cache parent directory in the current directory. If qmake can not find this file, it will ignore this process step silently.

If qmake find .qmake.cache file, you will first process the file before processing the project file.

File name extension

Under normal circumstances, qmake will try to use the appropriate file name extension for your platform. However, sometimes it is necessary to override the default options for each platform and well-defined file extensions for qmake use. This is achieved by redefining certain built-in variables. For example, you can be redefined by the following settings in the project file for the extension moc file: 

QMAKE_EXT_MOC = .mymoc

The following variables can be used to redefine common file extensions can identify qmake:
QMAKE_EXT_MOC moc change the extension included in the file.
QMAKE_EXT_UI modified for extension Qt Designer UI file (usually in the FORMS).
QMAKE_EXT_PRL change the extension on the library dependencies.
QMAKE_EXT_LEX change the Lex file using the suffix (usually LEXSOURCES in).
QMAKE_EXT_YACC change Yacc used in the file suffix (usually YACCSOURCES in).
QMAKE_EXT_OBJ change the suffix used on the generated object files.
All of the above content to accept only the first value, so you only have to assign a value to be used throughout the project files. There are two variables can accept a list of values:
QMAKE_EXT_CPP qmake will make all files with these suffixes are interpreted as C ++ source files.
QMAKE_EXT_H qmake will make all files with these suffixes are interpreted as C and C ++ header files.

Published 25 original articles · won praise 0 · Views 3766

Guess you like

Origin blog.csdn.net/xuyouqiang1987/article/details/104086179