简体   繁体   English

在另一个qmake项目中包含一个qmake项目

[英]Include a qmake project in another qmake project

I have created an application in qt/c++ 我已经在qt / c ++中创建了一个应用程序

Browser/Browser.pro Browser / Browser.pro

To start the browser, I need an agent. 要启动浏览器,我需要一个代理。 I have created an agent and store it in the Browser folder 我已经创建了一个代理并将其存储在Browser文件夹中

Browser/Browser.pro
        Browser.cpp
        main.cpp
        Agent/Agent.pro
        Agent/agent.cpp

When building the Browser, I'm generating an app but it's only build the browser. 构建浏览器时,我正在生成一个应用程序,但它只是构建浏览器。

I have added in Browser.pro the line below: 我在Browser.pro中添加了以下行:

SUBDIRS += \
  Agent/Agent.pro

browser.depend = Agent/Agent.pro

My concerns is that I'm trying to build browser.app and automatically agent.app . 我担心的是,我正在尝试构建browser.app并自动构建agent.app。 The goal after is to integrate the the agent.app generated in the resource of the browser.app 之后的目标是集成在browser.app的资源中生成的agent.app

Any idea 任何想法

SUBDIRS variable is only interpreted in TEMPLATE=subdirs pro file. SUBDIRS变量仅在TEMPLATE=subdirs pro文件中解释。 Also, it does take only the directory name where to find your project, not the .pro itself. 另外,它只使用目录名称来查找项目,而不使用.pro本身。

You should create a directory for your Browser project and get this: 您应该为Browser项目创建一个目录并获取以下内容:

Browser/
       |-Browser.pro
       |-Browser/
                |-Browser.pro
                |- ...
       |-Agent/
              |-Agent.pro
              |- ...

And then your main project file will be like this: 然后您的主项目文件将如下所示:

Browser.pro: Browser.pro:

    TEMPLATE = subdirs
    SUBDIRS = Agent Browser
    CONFIG += ordered

More information about subdirs : http://doc.qt.io/qt-5/qmake-variable-reference.html#subdirs 有关子目录的更多信息: http : //doc.qt.io/qt-5/qmake-variable-reference.html#subdirs

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

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