分享

How to add pre-build step in qmake/qtcreator?

 cwhbox 2012-01-15

If you were to pass the version information as an included file (let's say "version.h") instead of a #define, then you could add the following to your qmake file

# Define how to create version.h
version.target = version.h
version.commands = <PUT_YOUR_COMMANDS_HERE>
version.depends = .git

QMAKE_EXTRA_TARGETS += version

PRE_TARGETDEPS += version.h

The first 3 lines tell how to make a new target object called "version" that generates "version.h". It is made by executing the commands "". The target is dependent on ".git"

The "QMAKE_EXTRA_TARGETS" says there is a new target known as "version".

The "PRE_TARGETDEPS" indicates that "version.h" needs to exist before anything else can be done (which forces it to be made if it isn't already made).

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多