如何指定输入QMake INSTALLS变量?

时间:2012-02-21 12:25:33

标签: qt qmake

在我的Qt项目中,我正在尝试将库复制为构建过程的一部分。目标是在构建完所有动态库之后进行现成的分发。

使用INSTALLS变量似乎可以实现,但我发现文档有点薄: qmake Variable Reference: INSTALLS

在给出的例子中:

  • target是否已定义,或是通过撰写target.path =
  • 来定义的
  • 可能会员的文件在哪里? .path和......?

2 个答案:

答案 0 :(得分:22)

是的,这里的文档有很多不足之处。

target已经定义,但这是一个特例。您可以定义自己的其他部署集。以下是我们指定图像格式插件的方法:

imageformats.path = /opt/some/path/bin/imageformats
imageformats.files += $$[QT_INSTALL_DATA]/plugins/imageformats/*.so
INSTALLS += imageformats

以下是有关这三个命令的最小文档:http://doc.qt.io/qt-4.8/qmake-environment-reference.html#installs

yourset.path = /path/in/which/to/install/files
yourset.files = /files/to/install
yourset.extra = custom commands to run, eg. `touch somefile.txt`
INSTALLS += yourset

答案 1 :(得分:10)

target是你想要使用的任何字符串。这是你自己的标识符。

target.files定义了您要安装的内容。

target.path是您要将target.files放入的位置(目录)。

例如,假设我有一个名为“config.xml”的文件,我想复制到目录“xyzzy”。我将在qmake .pro文件中使用以下内容来指定。

my_file.files = config.xml
my_file.path = xyzzy

INSTALLS += my_file

顺便说一句,要实际制作文件副本,您必须执行make install

您可能还会发现答案有助于理解:Copy a file to build directory

相关问题