Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. What is the actual scope of qmake DEFINES?
Qt 6.11 is out! See what's new in the release blog

What is the actual scope of qmake DEFINES?

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 2 Posters 3.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #1

    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

    DEFINES += QDEBUG_EXT

    CONFIG += ordered
    SUBDIRS +=
    ../Libs
    ../MyApp
    @

    Libs.pro
    @
    TEMPLATE = subdirs

    CONFIG += ordered
    SUBDIRS +=
    ../Lib1
    ../Lib2
    ../Lib3
    ../Lib4
    ../Lib5
    @

    Lib3.pro
    @
    TEMPLATE = lib
    TARGET = Lib3

    QT += core network
    CONFIG += staticlib
    CONFIG += stl
    DEFINES += QT_NETWORK_LIB
    #DEFINES += QDEBUG_EXT

    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?

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        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?

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You have .qmake.cache for Qt 4

          The link in my last post talks about these two files

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            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

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You're welcome !

              Happens to everybody ;)

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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved