简体   繁体   English

在我的qmake项目中包含另一个项目的qmake文件

[英]Include another project's qmake file in my qmake's project

I'm tired of having to compile Qwt (or any other Qt project for that matter) separately every time when something changes, such as the version of Qt or the architecture. 每当每次发生更改(例如Qt的版本或体系结构)时,我都不得不分别编译Qwt (或与此相关的任何其他Qt项目),我感到厌倦。 So: 所以:

I would like to add the make file of Qwt to my project, such that the files of Qwt, that get compiled, go into my shadow build folder, where I can link with them easily without having to modify my qmake pro file. 我想将Qwt的make文件添加到我的项目中,以便将要编译的Qwt的文件放到我的shadow build文件夹中,在这里我可以轻松地与它们链接,而无需修改我的qmake pro文件。

How can I do that? 我怎样才能做到这一点?

Apparently including the qmake file with include(../Qwt/qwt.pro) in my project doesn't do it. 显然,在我的项目中include(../Qwt/qwt.pro)带有include(../Qwt/qwt.pro)的qmake文件并没有做到这一点。 Doing this will make Qt search for Qwt files in the project's qmake file's directory. 这样做将使Qt在项目的qmake文件的目录中搜索Qwt文件。

There's not much documentation provided about that. 没有提供太多的文档。 All I could find is one page which talks very briefly about it. 我只能找到一页简短地谈论它的页面。

Thank you for any efforts. 谢谢您的努力。

I think all you need is subdirs project template. 我认为您所需要的只是subdirs项目模板。

Example: In my repo I have 3 projects in 3 different folders. 示例:在我的仓库中,我在3个不同的文件夹中有3个项目。 Folders struct: 文件夹结构:

MyProject\
    MyProject.pro
    Project_1\
        Project_1.pro
    Project_2\
        Project_2.pro
    Peoject_3\
        Project_3.pro

In root directory I have project with template subdirs (MyProject.pro): 在根目录中,我的项目带有模板subdirs (MyProject.pro):

TEMPLATE = subdirs

SUBDIRS = \
    Project_1 \
    Project_2 \
    Project_3 

Project_3.depends = Project_1 Project_2 

Then I build MyProject.pro, it compiles all projects to shadow build directory. 然后,我构建MyProject.pro,它将所有项目编译到影子构建目录。 Then I rebuild only projects that I change. 然后,我仅重建我更改的项目。 When I need rebuild all projects, I buld MyProject.pro. 当我需要重建所有项目时,我将选择MyProject.pro。 No need to modify any .pro files. 无需修改任何.pro文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM