分享一个Qt 工程文件pro自动执行编译后事件(比如strip, 加密压缩, 复制到指定地方)的方法, 编译前自动生成version.h
test.pro:
TARGET = test ###目标文件名
QMAKE_POST_LINK += arm-linux-strip $$(TARGET);###去除调试符号
QMAKE_POST_LINK += 7za a $$(TARGET).7z -pmima $$(TARGET)
QMAKE_POST_LINK += cp $$(TARGET) $$(TARGET).7z /mnt/hgfs/D/ ###拷贝到宿主机D盘
参考链接2: How to add pre-build step in qmake/qtcreator?
# Define how to create version.h
version.target = version.h
version.commands = <PUT_YOUR_COMMANDS_HERE> ###在这里调用shell脚本(svn,git)自动生成版本号文件 version.h
version.depends = .gitQMAKE_EXTRA_TARGETS += version
PRE_TARGETDEPS += version.h
离线
参考链接: C++ GUI Programming with Qt4: Building Qt Applications
Table B.2. Variable accessors available in qmake
Accessor Description
$$ varName or $${ varName } Value of qmake variable at that point in the .pro file
$$( varName ) Value of environment variable when qmake is run
$( varName ) Value of environment variable when makefile is processed
$$[ varName ] Value of Qt configuration option
上面是Qt工程文件如何使用各种变量
离线
离线