qt文档详细介绍位置:Qt 5.12->qmake Manual->Advanced Usage

qmake 允许用户使用自定义的features,通过在添加变量的方式添加到qmake的CONFIG变量中。

features 是用户自定义的qmake language语法形式的 函数(function) 和 定义(definitions),以prf后缀的文件形式存放,可以放到各种自定义的路径下。

下面是QtInstallDir\Qt5.12.0\5.12.0\msvc2015_64\mkspecs\features中的cmake_functions.prf文件,其中定义了一些qmake语言写的replace函数。

#
#  W A R N I N G
#  -------------
#
# This file is not part of the Qt API.  It exists purely as an
# implementation detail.  It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#defineReplace(cmakeModuleName) {_module = $$1_name = $$eval(QT.$${_module}.name)cmake_module_name = $$replace(_name, ^Qt, )return ($$cmake_module_name)
}defineReplace(cmakeModuleList) {variable = $$1out =for(v, variable) {out += $$cmakeModuleName($$v)}return ($$join(out, ";"))
}defineReplace(cmakeTargetPath) {SYSR = $$[QT_SYSROOT]!isEmpty(SYSR): path = /$$relative_path($$1, $$[QT_SYSROOT])else: path = $$1return($$clean_path($$path))
}defineReplace(cmakeTargetPaths) {variable = $$1out =for(v, variable) {out += \"$$cmakeTargetPath($$v)\"}return ($$join(out, " "))
}defineReplace(cmakePortablePaths) {variable = $$1out =for(v, variable) {out += $$[QT_SYSROOT]$$cmakeTargetPath($$v)}return ($$join(out, ";"))
}defineReplace(cmakeProcessLibs) {variable = $$1out =for(v, variable) {if(!equals(v, -framework):!contains(v, -L.*)) {v ~= s,^-l,,v ~= s,^-lib,,v ~= s,.lib$,,out += $$v}}return ($$join(out, ";"))
}defineReplace(cmakeRelativePath) {path = $$relative_path($$1, $$2)return($$replace(path, ([^/])$, \\1/))
}

Qt 5.12->qmake Manual->Advanced Usage内容节选:

qmake lets you create your own features that can be included in project files by adding their names to the list of values specified by the CONFIG variable. Features are collections of custom functions and definitions in .prf files that can reside in one of many standard directories. The locations of these directories are defined in a number of places, and qmake checks each of them in the following order when it looks for .prf files:

  1. In a directory listed in the QMAKEFEATURES environment variable that contains a list of directories delimited by the platform's path list separator (colon for Unix, semicolon for Windows).
  2. In a directory listed in the QMAKEFEATURES property variable that contains a list of directories delimited by the platform's path list separator.
  3. In a features directory residing within a mkspecs directory. mkspecs directories can be located beneath any of the directories listed in the QMAKEPATH environment variable that contains a list of directories delimited by the platform's path list separator. For example: $QMAKEPATH/mkspecs/<features>.
  4. In a features directory residing beneath the directory provided by the QMAKESPEC environment variable. For example: $QMAKESPEC/<features>.
  5. In a features directory residing in the data_install/mkspecs directory. For example: data_install/mkspecs/<features>.
  6. In a features directory that exists as a sibling of the directory specified by the QMAKESPEC environment variable. For example: $QMAKESPEC/../<features>.

The following features directories are searched for features files:

  1. features/unix, features/win32, or features/macx, depending on the platform in use
  2. features/

For example, consider the following assignment in a project file:

  CONFIG += myfeatures

With this addition to the CONFIG variable, qmake will search the locations listed above for the myfeatures.prf file after it has finished parsing your project file. On Unix systems, it will look for the following file:

  1. $QMAKEFEATURES/myfeatures.prf (for each directory listed in the QMAKEFEATURES environment variable)
  2. $$QMAKEFEATURES/myfeatures.prf (for each directory listed in the QMAKEFEATURES property variable)
  3. myfeatures.prf (in the project's root directory)
  4. $QMAKEPATH/mkspecs/features/unix/myfeatures.prf and $QMAKEPATH/mkspecs/features/myfeatures.prf (for each directory listed in the QMAKEPATH environment variable)
  5. $QMAKESPEC/features/unix/myfeatures.prf and $QMAKESPEC/features/myfeatures.prf
  6. data_install/mkspecs/features/unix/myfeatures.prf and data_install/mkspecs/features/myfeatures.prf
  7. $QMAKESPEC/../features/unix/myfeatures.prf and $QMAKESPEC/../features/myfeatures.prf

Note: The .prf files must have names in lower case.

自定义的.prf文件放置的路径有严格的要求,可以通过设置环境变量QMAKEFEATURES、QMAKEPATH、QMAKESPEC,指定特定的目录(可以有多个目录),或者设置QMAKEFEATURES属性(qt环境变量、属性、变量 区分和设置)。将.prf放到上面的环境变量或属性指定的目录下的features/文件夹或者fetures/$$platform文件夹中。然后在CONFIG+=myfeature。

qmake 与 配置文件 
qmake language qt 工程文件 配置文件 .pro .prl .prf 词法 语法 for循环 判断语句 函数定义_丘上人的博客-CSDN博客

qmake *.prf文件 自定义features相关推荐

  1. qmake运行时依赖的配置文件集 qmake.conf、.qmake.conf、.qmake.stash、.qmake.super、.qmake.cache文件

    qmake.conf是qmake根据.pro文件生成makefile时默认依赖的qmake language语法的配置文件之一.生成makefile所依赖的配置文件在makefile中有展现,下面是M ...

  2. java 柱状图jar_GitHub - mafulong/NetworkExper: 计网实验,抓包,java,jigloo界面开发,柱状图,文件自定义保存...

    jiWangShiYanByJava 计网实验,抓包,java,jigloo界面开发,柱状图,文件自定义保存 基于Winpcap的网络流量统计分析系统的设计与实现 一.实验内容描述 本实验是用java ...

  3. java 下载db文件_Java下载文件自定义名称和格式类型

    response.setContentType()的作用是使客户端浏览器,区分不同种类的数据,并根据不同的MIME调用浏览器内不同的程序嵌入模块来处理相应的数据,可以设置文件格式.参考数据如下: re ...

  4. 原生JS实现文件自定义位置盖章功能并导出PDF

    原生JS实现文件自定义位置盖章功能并导出PDF 实现原理 在需要签章的文件上面创建一个div,可以通过移动这个div来确定签章位置,然后在通过获取这个位置把章子替换到这,并导出PDF,可以多次盖章! ...

  5. vue单文件自定义指令的封装

        vue单文件自定义指令的封装 第一步(封装一个js文件) // 暴露并配置指令 功能添加背景颜色 export const mycolor = {// 解析结构完成后自动运行钩子函数inser ...

  6. CodeBlocks: 生成的exe文件自定义一个图标

    CodeBlocks生成的exe文件的图标默认是系统图标,如何自定义一个漂亮的小图标呢? 我是C菜鸟,平时只用CodeBlocks练习c,也不开发什么软件,这个问题就难倒我了. 到网上搜索了一下,发现 ...

  7. 【RecyclerView】 一、RecyclerView 最基本用法 ( 添加支持库 | 设置布局文件 | 自定义适配器 )

    文章目录 一.添加支持库 二.布局文件中使用 RecyclerView 三.自定义适配器 四.RecyclerView 设置流程 五.RecyclerView 完整 Java 代码示例 一.添加支持库 ...

  8. 文件自定义变量_awk 内置变量与自定义变量

    点击上方"生信科技爱好者",马上关注真爱,请置顶或星标 作者:ghostwu 原文:https://www.cnblogs.com/ghostwu/p/9085653.html A ...

  9. 如何在.config文件自定义配置节

    在.NET程序中一般都有个应用程序配置文件在ASP.NET中是web.config,在控制台应用程序和Windows应用程序中是app.config.我们通常使用此配置文件来设置一些程序会用到的信息, ...

最新文章

  1. shell-init: error
  2. Celery - 一个懂得 异步任务 , 定时任务 , 周期任务 的芹菜
  3. Python自动化运维之15、网络编程之socket、socketserver、select、twisted
  4. C#多态“说来也说”——逻辑层BLL中的多态使用
  5. CentOS 关闭防火墙selinux
  6. 网购中7天无理由退货、运费险及退货退款流程图
  7. linux平台生成awr报告,Linux平台生成awr报告
  8. div+css+js实现深圳交互地图
  9. laravel7 LogicException Please make sure the PHP Redis extension is installed and enabled
  10. MySQL项目练习2——员工信息表项目
  11. 寄生电容和分布电容的区别
  12. 雷林鹏最人性化访谈:做投资不仅仅是要赚钱,要成为有价值的人
  13. 清华学霸讲计算机,清华学霸的霸气演讲!看完后才明白人与人的差距就是这样拉开的!...
  14. Java+MySQL基于ssm的物理竞赛管理系统 开题 论文
  15. Vue Echarts英文版地图——强大的高德地图
  16. Q-Learning 、Sarsa与 DQN算法
  17. Redmi Note 10 root权限 刷机教程,红米note10 root 线刷救砖包
  18. 【Error】 Linux系统“检测到系统程序错误”
  19. 离散数学与组合数学-04图论上
  20. 最简单实现微信活动报名功能,只要加我的微信号就行。

热门文章

  1. 智能盘点,Yolo用于钢筋检测计数
  2. 现代计算机体系结构介绍
  3. 3.3V降压1.2V高效率大电流电源芯片
  4. C# Chart折线图使用鼠标滚轮放大、缩小和平移曲线方式
  5. PS安装包及教程(Photoshop cc2018)
  6. 关于kafka中的反序列化
  7. 飞腾ASP CMS v3.1发布
  8. 重置计算机后无法开机,联想电脑。win10重置后无法开机,一直是lenovo那里重启?...
  9. ie 8无法安装因为您的计算机上,win10系统无法安装iE8 提示“此安装不支持您的操作系统的方案介绍...
  10. IDES ABAP/4破解及client copy [转]