Each QMake variable is a list. The regex line in your example works on each value in the list in isolation. When you do not quote the system() output the list gets a populated with elements by splitting on white space. The "-arch" and "arg" go into separate list elements, neither of which matches your regex
When you quote (or $$quote()) the system call output you put a single value in the list. Your qmake regex now works but anywhere the single list entry is output into a command line the spaces will be quoted as you have seen.
I'd be inclined to do this on UNIX-ish systems:
MYSQLIBS = $$system(mysql_config --libs | sed -r 's/-arch +[a-z0-9_]+//g')
LIBS += MYSQLIBS
MYSQLIBS = $$system(mysql_config --libs | sed -r 's/-arch +[a-z0-9_]+//g')
LIBS += MYSQLIBS
To copy to clipboard, switch view to plain text mode
to remove the -arch arg before qmake sees it.
However: you can also use the [wiki=Undocumented_qmake#Undocumented_functions]undocumented split()[/wiki] function thus:
MYSQLIBS = $$quote($$system(mysql_config --libs))
MYSQLIBS ~= s/-arch +[a-z0-9_]+//g #remove all "-arch arg" settings
MYSQLIBS = $$split(MYSQLIBS," ")
LIBS += $$MYSQLIBS
MYSQLIBS = $$quote($$system(mysql_config --libs))
MYSQLIBS ~= s/-arch +[a-z0-9_]+//g #remove all "-arch arg" settings
MYSQLIBS = $$split(MYSQLIBS," ")
LIBS += $$MYSQLIBS
To copy to clipboard, switch view to plain text mode
For the QMAKE_LFLAGS problem. I see the same effect on Linux when unquoted and I am guessing that internally the unique() function is used on the QMAKE_LFLAGS variable. When I do this:
EXTRA_FLAGS = "-arch i386"
QMAKE_LFLAGS += $$EXTRA_FLAGS
EXTRA_FLAGS = "-arch i386"
QMAKE_LFLAGS += $$EXTRA_FLAGS
To copy to clipboard, switch view to plain text mode
the second "-arch i386" completely disappears from the Makefile.
Why do you need to duplicate this entry? Will the linker accept "-arch:386" or "-arch=386"?
Bookmarks