QT PRI文件中的文件路径通过函数
我正在.pri文件中创建一个函数,该函数将包含在一个.pro文件中,目的是能够执行:
template(subdirs)
addMyProject(libA)
addMyProject(libB)
addMyProject(libC)
而不是
template(subdirs)
SUBDIRS += libA
libA.path = source/
SUBDIRS += libB
libB.path = source/
SUBDIRS += libC
libC.path = source/
如果我想使用依赖关系关键字,
同一问题。我当前的实现是以下一个:
defineTest(addMyProject) {
library_name = $$1
SUBDIRS += $$library_name
export(SUBDIRS)
{$$library_name}.file = {$$library_name}/source/{$$library_name}.pro
QMAKE_EXTRA_TARGETS += {$$library_name}
export(QMAKE_EXTRA_TARGETS)
}
子段部分还可以。我试图以不同的方式使其适用于.file部分,但我仍然没有找到解决方案。
有提示吗?
[编辑]
每个库都包含不同的子项目,目标是让QT创建者仅查看其中一个(路径源/LibraryName.pro的一个)。 问题在于所有库都正确显示,但也是所有其他子项目。基本上,只有subdirs变量才能识别,但不识别.file关键字)
I am creating a function in a .pri file that will be included in a .pro file with the intent of being able to do:
template(subdirs)
addMyProject(libA)
addMyProject(libB)
addMyProject(libC)
instead of
template(subdirs)
SUBDIRS += libA
libA.path = source/
SUBDIRS += libB
libB.path = source/
SUBDIRS += libC
libC.path = source/
Same problem if I want to use the depend keyword.
My current implementation is the following one:
defineTest(addMyProject) {
library_name = $1
SUBDIRS += $library_name
export(SUBDIRS)
{$library_name}.file = {$library_name}/source/{$library_name}.pro
QMAKE_EXTRA_TARGETS += {$library_name}
export(QMAKE_EXTRA_TARGETS)
}
The SUBDIRS part is ok. I have tried to make it work for the .file part in different ways, but still I have not found a solution.
Any hints?
[EDIT]
Each library contains different sub-projects, and the goal is to let Qt creator see only one of them (the one at the path source/libraryname.pro).
The issue is that all the libraries are correctly displayed, but also all the other sub-projects. Basically, only the SUBDIRS variable is recognised, but not the .file keyword)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论