是否可以在父子目录项目中修改QT qmake变量? [英] Is it possible to modify QT qmake variable in the parent subdirs project?

查看:151
本文介绍了是否可以在父子目录项目中修改QT qmake变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个共享库项目,其结构如下:

I have the shared library project with structure like this:

library.pro:

library.pro:

TEMPLATE = subdirs
CONFIG  += ordered
SUBDIRS += libs plugins test_programs
...
QT += concurrent
...
# Those files contains pure interfaces (C++ abstract classes)
# with no implementation, and some helper classes with inline implementation.
# So there is no reason to create yet another subproject for them
HEADERS += iface/IInterface1.h \   
           iface/IInterface2.h \ # IInterface2 needs QtConcurrent
           ...

IInterface2.h:

IInterface2.h:

...
#include <QtConcurrent> // ERROR HERE: file not found, i.e. qmake ignores
                        // "QT += concurrent" statement in library.pro

class MyHelperExc : public QtConcurrent::Exception
{ ... }

class IInterface2: public virtual IBaseInterface
{ ... }

所以,我的问题是:qmake只是忽略了SUBDIRS父项目中的变量操作. 但是在子项目中也可以. 我在做什么错了?

So, my problem is: qmake just ignores variable operations in SUBDIRS parent project. But it works ok in subprojects. What am i doing wrong?

推荐答案

TEMPLATE = subdirs

此行说,library.pro只是其他项目的容器,包含在SUBDIRS变量中列出的子目录中.除了CONFIG += ordered以外,library.pro中的其他大多数变量都将被忽略,它指定应按给定子目录的顺序处理子目录.

This line says that library.pro is just a container for other projects, contained within the subdirectories listed in the SUBDIRS variable. Most other variables in library.pro are ignored, except CONFIG += ordered, which specifies that the subdirectories should be processed in the order in which they are given.

包含IInterface2.h的子项目都需要在其.pro文件中包含QT += concurrent.

The subprojects which include IInterface2.h all need to have QT += concurrent in their .pro files.

这篇关于是否可以在父子目录项目中修改QT qmake变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆