Qmake INCLUDEPATH problem

  • Hi,

    i am working with Qt on Windows 7. I have a build.bat where all necessary steps are called (qmake, nmake,...).
    In the build.bat i set a path to the include-directory of the JDK:

    set JDK="C:\Program Files\Java\jdk1.7.0_02"
    (in the batch file there is only one backslash as seperator, i dont know why this editor puts in two"

    in my .pro-file i want to pass this path to INCLUDEPATH with:

    INCLUDEPATH += $$(JDK)/include


    INCLUDEPATH += $$(JDK)/include/win32

    I additionaly use Visual Studio 2010. Opening the pro-File creates a Project, but the include path are wrong. It only shows:

    "/include/win32". The string behind $$(JDK) is gone. I tried everything i could think of till now:

    t = $$quote($$quote($$replace(jdk, \\, /)/include/win32))
    INCLUDEPATH += $$t

    but this does not work either. The strange thing is, messaging $$t in this case shows:

    "C:/Program Files/Java/jdk1.7.0_02"/include/win32
    (I cannot get rid of the spaces in this string)

    i even tried to $$replace the quotations, but that did not work.
    Any suggestions would be very appreciated!



  • Moderators

    It might be different on windows (I doubt it), but on GNU/Linux, variables are denoted with $${}, not $$() for example:
    INCLUDEPATH += $${JDK}/include

  • And as you have spaces in the path, you need to put the result between quotes:

    INCLUDEPATH += "$${JDK}/include"
    INCLUDEPATH += "$${JDK}/include/win32"

  • The qmake-docs say round brackets are right. "{" don`t work for me here.
    That does not work. In VS the resulting path is still just "/include" and "/include/win32".
    The funny thing is that message($$INCLUDEPATH) reports this:
    C:\Program Files\Java\jdk1.7.0_02/include

    In VS the first part of the string is gone. Weird. Replacing the "" with "/" does not change a thing.

    Thanks, but seems like a bug to me somewhere.

  • ah, correct. Environment vars are accessed with $$(xxx) and qmake variables with $${xxx}.

Log in to reply

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