首页| 论坛| 消息

标题:在QT Creator 中使用MSVC编译时,pro中设置DISTFILES 无效,需要如何配置
作者:jerrybaxia
日期:2020-12-13 23:05
内容:

我在项目中需要把我的 log4qt.properties 这个配置文件在构建或编译的时候,可以自动复制到我的debug或release目录
但我在pro文件中配置了
DISTFILES += \ $$PWD/log4qt.properties
但在实际的构建和编译过程中,并不会把文件复制到debug或release目录中
我查看帮助说明:
https://doc.qt.io/qt-5/qmake-variable-reference.html#distfiles

Specifies a list of files to be included in the dist target. This feature is supported by UnixMake specs only.
大意说这个功能只是在UnixMake中有效
但我现在是用的Windows + MSVC + QTCreator 需要如何实现构造和编译过程,把以把我需的文件复制到debug或release?
现在每次构造后,都要手动进行复制,比较麻烦

谢谢


#1 [青空飞羽 12-14 09:15]
.pro中加入
inst.files += $$PWD/log4qt.properties
inst.path = $bin_dir
INSTALLS += inst

然后增加编译步骤:
make install
#2 [zy1233 12-14 10:51]
写个bat文件复制,然后再make步骤添加这个bat文件
#3 回 青空飞羽 的帖子 [jerrybaxia 12-14 22:40]
青空飞羽:.pro中加入
inst.files += $$PWD/log4qt.properties
inst.path = $bin_dir
....... (2020-12-14 09:15) 
你好:
我已经在pro中添加了
============================================
inst.files += $$PWD/log4qt.properties
inst.path = $bin_dir
INSTALLS += inst
======================================
然后也在【项目】的【构建设置】中的【构建步骤】添加了【自定义进程步骤】
使命:qmake, 参数:install,工作目录:%{buildDir}
但还是没有效果
请问还少了哪个步骤
谢谢
#4 回 jerrybaxia 的帖子 [青空飞羽 12-15 09:10]
jerrybaxia:你好:
我已经在pro中添加了
============================================
inst.files += $$PWD/log4qt.properties
....... (2020-12-14 22:40) 
bin_dir是自定义变量,就是要拷贝到的目录
#5 [jerrybaxia 12-22 21:50]
已经在 pro 中添加编译参数解决
QMAKE_POST_LINK += cd $$PWD & CALL install.bat

回复 发表
主题 版块