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

Bug#392902: [Issue N134476] qmake no longer escapes quotes for -Dfoo="value" on gcc c ommand line



On Saturday, 14. Oct 2006 17:45 pyro@debian.org wrote:
>
> The following person has submitted a bug report through our online
> feedback form
> Name: Brian Nelson
> Email: pyro@debian.org
>
> Product: Qt
> Function: BuildSystem
> Version: 4.2.0
>
> Platform: Linux
> Platform details: Debian unstable
>
> Compiler: GCC
> Compiler details:
>
> Short description:
> qmake no longer escapes quotes for -Dfoo="value" on gcc command line
>
> What I did:
> This was filed as a bug in Debian.  The full report is available at
> http://bugs.debian.org/392902.
>
> Ipe uses qmake to build, with a "config.pri" file that contains the
> following:
>
>   IPEDOCDIR  = $${IPEPREFIX}/share/doc/ipe/doc
>
> Back in July, the generated Makefile resulted in
>
>   -DIPEDOCDIR=\"/usr/share/doc/ipe/doc\"
>
> passed to the g++ command line -- see the ipe buildd logs.  Now it is
> passing
>
>   -DIPEDOCDIR="/usr/share/doc/ipe/doc"
>
> which, not surprisingly, causes a syntax error and the build fails.
>
> What I expected to see:
>
>
> What I got instead:
>
>
> More info:

Yes, this is a side effect from a change that was made to qmake for
the Qt 4.2.0 release. So to escape a " the \ alone will not work
anymore. Instead \\\ has to be used.

So your line would be:
DEFINES += TAGET=\\\"Hello\\\"

This causes an incompatibility between qmake versions.
To work around this, then append the following line:
DEFINES ~= s/\\\\\\/\/

Thus my simple .pro file looks like this:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
DEFINES += FOO=\\\""FOO is decleared"\\\"
DEFINES ~= s/\\\\\\/\/
# Input
SOURCES += main.cpp

This causes all the DEFINES to  be affected.

If you would prefer a capability-based checking variant, then try:

foo="bar"
bar=bar
!equals(foo,$$bar):QMAKE_QUIRKS+=keep_quotes

# Deal with qmake quirks
contains(QMAKE_QUIRKS,keep_quotes) {
        LITERAL_ESCAPED_QUOTE=\"

} else {
        LITERAL_ESCAPED_QUOTE=\\\"\"

}

DEFINES+=FOO=$${LITERAL_ESCAPED_QUOTE}"FOO is
defined"$${LITERAL_ESCAPED_QUOTE}

Hmm. Its a bit big, but works.

Hope this helps, and sorry for the inconvenience this causes you.

Regards,
Jørgen Lind, Support Engineer
--
Trolltech ASA - http://www.trolltech.com




Reply to: