Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved] Qt paths in qmake / .pro
Forum Updated to NodeBB v4.3 + New Features

[Solved] Qt paths in qmake / .pro

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 3 Posters 4.0k 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.
  • D Offline
    D Offline
    DerekDomino
    wrote on last edited by
    #1

    Hello,

    I'm using QDebug in debug mode and skipping it in release mode. I would like to avoid linking to Qt libraries for this project.

    In the .pro I've completed the INCLUDEPATH so that QDebug(.h) is found
    @
    release {
    DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_DEBUG
    CONFIG -= qt
    INCLUDEPATH += "......\QtSDK\Desktop\Qt\4.8.0\include" "......\QtSDK\Desktop\Qt\4.8.0\include\QtCore"
    }
    @

    It works well! Dependency Walker indicates that the executable generated does not depend on Qt dll's.

    The next step is to make this configuration cleaner:

    How to specify in a portable manner the path of the Qt include path?
    

    I would like to replace
    @ INCLUDEPATH += "......\QtSDK\Desktop\Qt\4.8.0\include" "......\QtSDK\Desktop\Qt\4.8.0\include\QtCore" @

    by something like
    @ INCLUDES += qt_include @

    to avoid refering to a particular installation path of the SDK that depends on the OS and the machine.

    Thanks

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Why do you need this Qt in includepath? Just don't use it at all. For a debug build, wrap include in a ifdef:
      @
      #ifdef DEBUG
      #include <QtDebug>
      #endif
      @

      Or is it not working?

      (Z(:^

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DerekDomino
        wrote on last edited by
        #3

        Hi Sierdzio,

        Thanks! It should be working but I have tens of "#include <QDebug>" and hundreds "qDebug() << ..." and having to test if DEBUG is defined at each call is cumbersome.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          miroslav
          wrote on last edited by
          #4

          It looks to me like you always want to include the QDebug header, but not link the Qt library in release mode. So you do not want to wrap "#include <QDebug>" in a define.

          The QMake variable QMAKE_INCDIR_QT may be of help. It should point to ......\QtSDK\Desktop\Qt\4.8.0\include in your case. Try adding

          @
          INCLUDEPATH += $$QMAKE_INCDIR_QT $$QMAKE_INCDIR_QT/QtCore
          @

          to get rid of the hard-coded paths.

          Mirko Boehm | mirko@kde.org | KDE e.V.
          FSFE Fellow
          Qt Certified Specialist

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DerekDomino
            wrote on last edited by
            #5

            Fantastic, it works perfectly. Thanks!

            So the code looks (changed the conditional test)

            @
            CONFIG(release, debug|release) { #release mode only
            DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_DEBUG
            CONFIG -= qt
            INCLUDEPATH += $$QMAKE_INCDIR_QT $$QMAKE_INCDIR_QT/QtCore
            }
            @

            Marked thread as [Solved] :-)

            Thanks!

            1 Reply Last reply
            0
            • M Offline
              M Offline
              miroslav
              wrote on last edited by
              #6

              Excellent ;-)

              Mirko Boehm | mirko@kde.org | KDE e.V.
              FSFE Fellow
              Qt Certified Specialist

              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