From 2ff3cbbb563f2e6176b3a153c233ae737246fe23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 23 Sep 2013 16:01:43 +0200 Subject: [PATCH] Xcode: Quote variable names with invalid characters in them Allows us to have scoped variables such as eg FOO[arch=armv7]. We could quote all variables, but Xcode doesn't, and we try to stay close to the native behavior. Change-Id: Ia6634a33e42031fe7e69c4f680803fa347e5de4a Reviewed-by: Andy Shaw --- qmake/generators/mac/pbuilder_pbx.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index b8e6d05728..719507c61d 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1804,7 +1804,10 @@ ProjectBuilderMakefileGenerator::writeSettings(const QString &var, const ProStri for(int i = 0; i < indent_level; ++i) newline += "\t"; - ret += var + " = "; + static QRegExp allowedVariableCharacters("^[a-zA-Z0-9_]*$"); + ret += var.contains(allowedVariableCharacters) ? var : quotedStringLiteral(var); + + ret += " = "; if(flags & SettingsAsList) { ret += "(" + newline;