qtqmake

QMake - How to add and use a variable into the .pro file


I have a qmake file generated by Qt creator. I am modifying it but I do not manage to understand how to create a variable.

For example, I want to declare the library MYPATH as I did here:

MYPATH = /lib/aaa/bbb
unix:!macx:!symbian: LIBS += -L$(MYPATH)

When I run qmake I find in the generated makefile

LIBS = ....... -L$(MYPATH) .....

But the MYPATH variable is not declared anywhere.

Does anyone know how to declare such a variable properly?


Solution

  • QMake uses its own syntax for variable references.

    Try it like this

    MYPATH = /lib/aaa/bbb
    unix:!macx:!symbian: LIBS += -L$${MYPATH}