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

后端 未结 2 1556
感动是毒
感动是毒 2020-11-30 20:10

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

2条回答
  •  抹茶落季
    2020-11-30 20:48

    QMake uses its own syntax for variable references.

    • VAR = foobar => Assign value to variable when qmake is run
    • $$VAR => QMake variable's value at the time qmake is run
    • $${VAR} => QMake variable's value at the time qmake is run (identical but enclosed to separate from surrounding text)
    • $(VAR) => Contents of an Environment variable at the time Makefile (not qmake) is run
    • $$(VAR) =>Contents of an Environment variable at the time qmake (not Makefile) is run

    Try it like this

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

提交回复
热议问题