Search code examples
qtqmakebuild-system

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 $]


Solution

  • 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