简体   繁体   English

是否可以在父子目录项目中修改QT qmake变量?

[英]Is it possible to modify QT qmake variable in the parent subdirs project?

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
{ ... }

So, my problem is: qmake just ignores variable operations in SUBDIRS parent project. 所以,我的问题是:qmake只是忽略SUBDIRS父项目中的变量操作。 But it works ok in subprojects. 但是在子项目中也可以。 What am i doing wrong? 我究竟做错了什么?

TEMPLATE = subdirs

This line says that library.pro is just a container for other projects, contained within the subdirectories listed in the SUBDIRS variable. 这一行说,library.pro只是其他项目的容器,包含在SUBDIRS变量中列出的子目录中。 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. 除了CONFIG += ordered之外,library.pro中的大多数其他变量都将被忽略,该变量指定应按给定子目录的顺序处理子目录。

The subprojects which include IInterface2.h all need to have QT += concurrent in their .pro files. 包含IInterface2.h的子项目都需要在其.pro文件中QT += concurrent存在QT += concurrent

What am i doing wrong? 我究竟做错了什么?

The fact that you think qmake would parse, however that is not how qmake is currently working. 您认为qmake可以解析的事实,但是qmake目前无法正常工作。 SUBDIRS will mean that it will only look in subfolders. SUBDIRS表示它将仅在子文件夹中查找。

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

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