Q:

Issue with space in qt pro file

I want to add macro (make constant) of the application name in qt pro file and use it later in code. For example:
QMAKE_TARGET_NAME = Foo Bar
DEFINES += APP_NAME=\\\"$$QMAKE_TARGET_NAME\\\"

When I use: qDebug() << APP_NAME it shows only "Foo". How to escape space in qt pro file? Thanks in advance for your help.

A:

DEFINES += APP_NAME=$$shell_quote($$QMAKE_TARGET_NAME)
or if the " should be part of the define, then
DEFINES += APP_NAME=$$shell_quote(\"$$QMAKE_TARGET_NAME\")

