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

情到浓时终转凉″ 提交于 2019-12-24 03:32:36

问题


I have the shared library project with structure like this:

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:

...
#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. But it works ok in subprojects. What am i doing wrong?


回答1:


TEMPLATE = subdirs

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.

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




回答2:


What am i doing wrong?

The fact that you think qmake would parse, however that is not how qmake is currently working. SUBDIRS will mean that it will only look in subfolders.



来源:https://stackoverflow.com/questions/22270456/is-it-possible-to-modify-qt-qmake-variable-in-the-parent-subdirs-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!