[工程构建] qmake中可使用的内置属性

qmake has a system for persistent configuration, which allows you to set a property in qmake once, and query it each time qmake is invoked. You can set a property in qmake as follows:

  qmake -set PROPERTY VALUE

The appropriate property and value should be substituted for PROPERTY and VALUE.

You can retrieve this information back from qmake as follows:

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

Note: qmake -query lists built-in properties in addition to the properties that you set with qmake -set PROPERTY VALUE.

This information will be saved into a QSettings object (meaning it will be stored in different places for different platforms).

The following list summarizes the built-in properties:

  • QMAKE_SPEC - the shortname of the host mkspec that is resolved and stored in the QMAKESPEC variable during a host build
  • QMAKE_VERSION - the current version of qmake
  • QMAKE_XSPEC - the shortname of the target mkspec that is resolved and stored in the QMAKESPEC variable during a target build
  • QT_HOST_BINS - location of host executables
  • QT_HOST_DATA - location of data for host executables used by qmake
  • QT_HOST_PREFIX - default prefix for all host paths
  • QT_INSTALL_ARCHDATA - location of general architecture-dependent Qt data
  • QT_INSTALL_BINS - location of Qt binaries (tools and applications)
  • QT_INSTALL_CONFIGURATION - location for Qt settings. Not applicable on Windows
  • QT_INSTALL_DATA - location of general architecture-independent Qt data
  • QT_INSTALL_DOCS - location of documentation
  • QT_INSTALL_EXAMPLES - location of examples
  • QT_INSTALL_HEADERS - location for all header files
  • QT_INSTALL_IMPORTS - location of QML 1.x extensions
  • QT_INSTALL_LIBEXECS - location of executables required by libraries at runtime
  • QT_INSTALL_LIBS - location of libraries
  • QT_INSTALL_PLUGINS - location of Qt plugins
  • QT_INSTALL_PREFIX - default prefix for all paths
  • QT_INSTALL_QML - location of QML 2.x extensions
  • QT_INSTALL_TESTS - location of Qt test cases
  • QT_INSTALL_TRANSLATIONS - location of translation information for Qt strings
  • QT_SYSROOT - the sysroot used by the target build environment
  • QT_VERSION - the Qt version. We recommend that you query Qt module specific version numbers by using $$QT.<module>.version variables instead.

For example, you can query the installation of Qt for this version of qmake with the QT_INSTALL_PREFIX property:

  qmake -query "QT_INSTALL_PREFIX"

You can query the values of properties in a project file as follows:

  QMAKE_VERS = $$[QMAKE_VERSION]

 

The special $$[...] operator can be used to access qmake properties:

  message(Qt version: $$[QT_VERSION])
  message(Qt is installed in $$[QT_INSTALL_PREFIX])
  message(Qt resources can be found in the following locations:)
  message(Documentation: $$[QT_INSTALL_DOCS])
  message(Header files: $$[QT_INSTALL_HEADERS])
  message(Libraries: $$[QT_INSTALL_LIBS])
  message(Binary files (executables): $$[QT_INSTALL_BINS])
  message(Plugins: $$[QT_INSTALL_PLUGINS])
  message(Data files: $$[QT_INSTALL_DATA])
  message(Translation files: $$[QT_INSTALL_TRANSLATIONS])
  message(Settings: $$[QT_INSTALL_CONFIGURATION])
  message(Examples: $$[QT_INSTALL_EXAMPLES])
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值