Alvaro Fagner
Alvaro Fagner

Reputation: 23

QMake: Use string as variable

I have a string and I want to use it as part of another variable name

QT_MODULE_NAME = xml

# I would like to use something like this:
LIB_PATH = $${QT.$${QT_MODULE_NAME}.libs}

But it does not seem to work. I get Missing } terminator [found $]

Upvotes: 2

Views: 415

Answers (1)

Former contributor
Former contributor

Reputation: 2576

Try this:

QT_MODULE_NAME = xml
LIB_PATH = $$eval("QT.$${QT_MODULE_NAME}.libs")
message($$LIB_PATH)

output:

Project MESSAGE: /home/pedro/Qt/5.12.7/gcc_64/lib

Upvotes: 2

Related Questions