可以在qmake中添加一个依赖关系到Makefile吗? [英] Is it possible to add a dependency to your Makefile in qmake?

查看:262
本文介绍了可以在qmake中添加一个依赖关系到Makefile吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有一个包含.pro文件使用并由qmake解析的某些版本标记信息的文件,但问题是当该文件更改时,qmake不会重新运行。

Currently, I have a file which contains some version tagging information which is used by the .pro file and parsed by qmake, but the problem is that when that file changes qmake is not re-run.

可以向.pro文件添加一些东西,以便qmake将该文件视为Makefile的依赖项。

Is it possible to add something to the .pro file so that qmake will treat this file as a dependency for the Makefile?

推荐答案

这样的事情应该有效:

depend_on_file.target = depend_on_file
depend_on_file.depends = path_to_your_txt_file
depend_on_file.CONFIG += recursive
QMAKE_EXTRA_TARGETS += depend_on_file
PRE_TARGETDEPS += depend_on_file

如果文件 path_to_your_txt_file 更改会重新生成,但请记住,如果解析文件的qmake脚本会更改DEFINES变量,那么您将失去运气。您看到的依赖关系中没有列出定义。如果定义已更改,则必须手动完成重建。

Rebuild will be triggered if file path_to_your_txt_file changes but keep in mind that if your qmake script that parses the file changes DEFINES variable then you out of luck. Defines are not listed in dependencies, you see. If defines are changed you have to do full rebuild by hand.

这篇关于可以在qmake中添加一个依赖关系到Makefile吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆