在我的Qt项目中,我正在尝试复制库作为构建过程的一部分.目标是在构建完成后使用所有必需的动态库进行现成的分发.
使用INSTALLS变量似乎是可行的,但我发现文档有点薄: qmake变量参考:INSTALLS
在给出的例子中:
target已经被定义,或者是通过写定义target.path =?.path和......?Dav*_*eer 23
是的,这里的文档有很多不足之处.
target已定义,但这是一个特例.您可以定义自己的其他部署集.以下是我们如何指定图像格式插件:
imageformats.path = /opt/some/path/bin/imageformats
imageformats.files += $$[QT_INSTALL_DATA]/plugins/imageformats/*.so
INSTALLS += imageformats
Run Code Online (Sandbox Code Playgroud)
以下是有关这三个命令的最小文档: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
Run Code Online (Sandbox Code Playgroud)
jwe*_*rny 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
Run Code Online (Sandbox Code Playgroud)
顺便说一句,要实际制作文件副本,你必须执行make install.
您也可以找到有助于理解的答案:将文件复制到构建目录.