将安装添加到QT pro文件

问题描述

编译qt app 时,我正在运行qmake && make。 我也想运行make install,所以我将填充信息添加到了pro文件中:

target.files += $$OUT_PWD/$(DESTDIR)/$(TARGET)
target.path += /opt/zview
INSTALLS += target

但正在运行make install

make: nothing to be done for 'install'.

如何将安装正确添加到我的专业文件中?

解决方法

qmake在将文件添加到安装目标之前检查文件是否存在。由于您的构建目标不存在,但它失败了。

您应该完全省略“ target.files”,以便让qmake自行决定(请参阅qmake手册Advanced Usage下的“安装文件”小节)。

# target.files are set by qmake automatically as it's a well-known set name
#target.files += $$OUT_PWD/$(DESTDIR)/$(TARGET)
target.path += /opt/zview
INSTALLS += target