[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#392902: workaround

See the thread at


To quote from the mailinglist:


It is a known change, and mostly an unintentional side effect. Because
qmake (and Qt's build system in general) supports spaces in file names we
had to use something to escape the space that qmake uses to separate items
passed in a list. We chose to use quotes and as a result to get a real
(escaped) quote to be passed straight through you have to escape it.
The work-arounds are clearly either to avoid doing it on the commandline
(and put it in a .h) or escape the quote if you must. We didn't notice it
in Qt's build system because we just generate a .h file that has our
#define. It isn't pretty but the levels of quote escaping are: 
1) qmake parses escapes 
2) make allows escaping variable assignment and expands properly 
3) /bin/sh also expands the quotes 
As a result to be absolutely portable it best to use the .h technique
because anyone of those steps above might not do quote expansion and thus
too much escaping can be bad. In the case of the DEFINES you want the quote
expansion to happen in /bin/sh so it must be escaped to get past make, and
now qmake also eats them to you have to escape the escape to get it past
qmake. The "best" solution available is:
contains($$list($$[QT_VERSION]), 4.2.*) { 
   DEFINES += FOO=\\\"$(FOO)\\\" 
} else { 
   DEFINES += FOO=\"$(FOO)\" 

This will allow a single .pro to work with <4.2.x as well as beyond. 

Reply to: