How to get path to QT includes?

  • Is It possible to obtain the path to QT headers in pro file ?
    (i.e. -I"C:\Qt\qt_minGW32_520\qtbase\include" -I"C:\Qt\qt_minGW32_520\qtbase\include\QtPrintSupport" e.t.c)
    I need this for the custom build step.
    The qmake generate this path's (in Make file) for INCPATH variable, but when I do that:


    It print only user include paths.
    I found that exist the: QMAKE_INCDIR, but message($${QMAKE_INCDIR}) - print the empty string.

  • @
    message(Header files: $$[QT_INSTALL_HEADERS])

    Edit: I misread your question.
    Qmake builds those simply by iterating over INCLUDEPATH, which has been built up from user and Qt inputs (via feature files like qt.prf and the QT variable)

  • I know about INCLUDEPATH, but it contain ONLY user path's
    For ensure let's try: message($$INCLUDEPATH)

    message(Header files: $$[QT_INSTALL_HEADERS]) - contain only one path to include directory. In my case it print

    Header files: C:/Qt/qt_minGW32_520/qtbase/include

    "The problem solves as":
    But, I'm not sure that is the good solution.

  • INCLUDEPATH is added to by the code in qt.prf . By the time qmake writes the Makefile all the -I paths are present. You cannot access this version directly but you can build the equivalent value... in exactly same sort of fashion as your "solution"

  • Run "qmake -query". That will dump all the information it has on the Qt it came with, including all kinds of directories containing binaries/headers/examples and whatnot.

Log in to reply