我有一个subdirs project具有以下结构的 Qt:
ExternalQtProject
QtSubdirProjects
- GUI
- WebService
WebService包含LIBS来自外部 Qt 项目(WebService 中的 .pro 文件)
LIBS += -L<path to ExternalQtProject>
LIBS += <some ExternalQtProject .obj files>
GUI使用 Web 服务(GUI 中的 .pro 文件):
LIBS += -L<path to WebService>
LIBS += <WebService .obj files>
所以基本上GUI是使用一个来自 的头文件WebService,而后者又使用来自ExternalQtProject.
问题:我遇到链接器问题,直到我将LIBS来自的条目WebService也包含在 中GUI,所以GUI最终得到来自 的所有 LIBS ExternalQtProject:
LIBS += -L<path to ExternalQtProject> # I want to avoid redefinition of this
LIBS += <some ExternalQtProject .obj files> # I want to avoid redefinition of this
LIBS += -L<path to WebService>
LIBS += <WebService .obj files>
由于有明确的依赖关系(GUI->WebService->ExternalQtProject),有没有办法避免对子项目LIBS重新定义?GUI
-- 编辑 1 --
如何使用 QMake 的 subdirs 模板?帮助我更好地构建我的项目,但还没有避免重复LIBS