I have a TEMPLATE = subdirs
project with 6 subprojects which build in specified order.
I would like to copy the output file of project1 (it's target) to some folder.
This folder is passed with LIBS += -L
to project2
and project2
may use this file as a static library.
I found some .pro
file commands to copy target files wherever but they are performed at deploy step. I need this to be done at build step. Precisely after project1
got built and before project2
build starts. And would be better if that will be some code that could be kept in .pro
file.
答案 0 :(得分:1)
在文件夹中创建DestDir.pri,其中包含所有项目。 插入下一个代码:
isEmpty(DESTDIR) {
CONFIG(debug, debug|release) {
DESTDIR=$$PWD/Build/Debug
}
CONFIG(release, debug|release) {
DESTDIR=$$PWD/Build/Release
}
}
将DestDir.pri包含在每个专业文件中:
include(../DestDir.pri)
您可以将DESTDIR变量更改为您的路径或通过qmake命令行utils设置此变量 - 在这两种情况下,此代码都会将您的人工制品定位到公共文件夹。
答案 1 :(得分:0)
我找到one more方法来实现这一目标:
copydata.commands = $(COPY_FILE) $$OUT_PWD/$(TARGET0) ~/my_libs/
first.depends = $(first) copydata
export(first.depends)
export(copydata.commands)
QMAKE_EXTRA_TARGETS += first copydata
它允许控制哪些库文件(.so,。so.1,.so.1.0,.so.1.0.0)被复制并且似乎是跨平台的,所以我也将它留在这里。
但我会使用Milovidov的解决方案,因为我的项目不那么复杂。