What is the actual scope of qmake DEFINES?
-
The DEFINES statement is typically used for specifying macro defines for compilers.I am wondering if there is specific scope set for DEFINES. However, this would make no sense in my opinion.
I am using a DEFINES statement in a .pro file for a library. The .pro file is used in a subdirs .pro file. Respectively, there are two layers of subdirs above.
For more flexibility I decided to move the DEFINES into the upmost .pro. However, it is not set when qmake is operating on the library's .pro file.The setup is similar as follows:
@
TEMPLATE = subdirsDEFINES += QDEBUG_EXT
CONFIG += ordered
SUBDIRS +=
../Libs
../MyApp
@Libs.pro
@
TEMPLATE = subdirsCONFIG += ordered
SUBDIRS +=
../Lib1
../Lib2
../Lib3
../Lib4
../Lib5
@Lib3.pro
@
TEMPLATE = lib
TARGET = Lib3QT += core network
CONFIG += staticlib
CONFIG += stl
DEFINES += QT_NETWORK_LIB
#DEFINES += QDEBUG_EXTmessage("DEFINES in Lib3 are : " $$DEFINES)
@The message statement does not display the additional setting QDEBUG_EXT as defined in the first .pro file.
Can someone shed some light on this?
-
Hi,
IIRC, the "state" of each subdir project is cleaned before it's build. You can however use a .qmake.conf file at the root of your project with the variables you'll like to set if you are using Qt 5.
More about this "here":http://qt-project.org/wiki/QMake-top-level-srcdir-and-builddir
-
Thanks SGaist for your answer.
That explains why it does not work. The documentation is a bit vague in that respect.[quote author="SGaist" date="1419804780"]... use a .qmake.conf file at the root of your project with the variables you'll like to set if you are using Qt 5.
[/quote]
Is this strictly limited to Qt5? -
You have .qmake.cache for Qt 4
The link in my last post talks about these two files
-
You're welcome !
Happens to everybody ;)
Hope you're not under too much snow yourself and all the best to you too !