Is it possible to add a dependency to your Makefile in qmake?

自作多情 提交于 2019-12-23 12:05:43

问题


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.

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


回答1:


Sometheing like this should work:

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

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.



来源:https://stackoverflow.com/questions/8434707/is-it-possible-to-add-a-dependency-to-your-makefile-in-qmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!