What is the actual scope of qmake DEFINES?

  • Moderators

    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 = subdirs


    CONFIG += ordered
    SUBDIRS +=

    TEMPLATE = subdirs

    CONFIG += ordered
    SUBDIRS +=

    TEMPLATE = lib
    TARGET = Lib3

    QT += core network
    CONFIG += staticlib
    CONFIG += stl

    message("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?

  • Lifetime Qt Champion


    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

  • Moderators

    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.
    Is this strictly limited to Qt5?

  • Lifetime Qt Champion

    You have .qmake.cache for Qt 4

    The link in my last post talks about these two files

  • Moderators

    Thanks for your patience.
    I did not read careful enough right away.

    Enjoy the snow in your part of CH and best wishes for the New Year

  • Lifetime Qt Champion

    You're welcome !

    Happens to everybody ;)

    Hope you're not under too much snow yourself and all the best to you too !

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.