summaryrefslogtreecommitdiff
path: root/Source/cmXCodeObject.cxx
diff options
context:
space:
mode:
authorJohan Björk <phb@spotify.com>2011-04-05 15:25:58 +0200
committerBrad King <brad.king@kitware.com>2011-04-07 13:17:03 -0400
commitc519bb2bb60a95c8b9145af0d9c90900f5b48f3d (patch)
treea74d402bce402c782e911bc2c22b2a9fefd76093 /Source/cmXCodeObject.cxx
parentc2f8a137152d9dc4cc08b156284f916561e1455c (diff)
downloadcmake-c519bb2bb60a95c8b9145af0d9c90900f5b48f3d.tar.gz
XCode: Also qoute [] as needed to set build-configurations.
Diffstat (limited to 'Source/cmXCodeObject.cxx')
-rw-r--r--Source/cmXCodeObject.cxx30
1 files changed, 20 insertions, 10 deletions
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 592047031b..71c7c2557b 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -146,13 +146,15 @@ void cmXCodeObject::Print(std::ostream& out)
if(j->second->TypeValue == STRING)
{
- out << j->first << " = ";
+ cmXCodeObject::PrintString(out,j->first);
+ out << " = ";
j->second->PrintString(out);
out << ";";
}
else if(j->second->TypeValue == OBJECT_LIST)
{
- out << j->first << " = (";
+ cmXCodeObject::PrintString(out,j->first);
+ out << " = (";
for(unsigned int k = 0; k < j->second->List.size(); k++)
{
if(j->second->List[k]->TypeValue == STRING)
@@ -169,7 +171,8 @@ void cmXCodeObject::Print(std::ostream& out)
}
else
{
- out << j->first << " = error_unexpected_TypeValue_" <<
+ cmXCodeObject::PrintString(out,j->first);
+ out << " = error_unexpected_TypeValue_" <<
j->second->TypeValue << ";";
}
@@ -180,7 +183,8 @@ void cmXCodeObject::Print(std::ostream& out)
}
else if(object->TypeValue == OBJECT_REF)
{
- out << i->first << " = " << object->Object->Id;
+ cmXCodeObject::PrintString(out,i->first);
+ out << " = " << object->Object->Id;
if(object->Object->HasComment() && i->first != "remoteGlobalIDString")
{
out << " ";
@@ -190,7 +194,8 @@ void cmXCodeObject::Print(std::ostream& out)
}
else if(object->TypeValue == STRING)
{
- out << i->first << " = ";
+ cmXCodeObject::PrintString(out,i->first);
+ out << " = ";
object->PrintString(out);
out << ";" << separator;
}
@@ -230,19 +235,19 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
}
//----------------------------------------------------------------------------
-void cmXCodeObject::PrintString(std::ostream& os) const
+void cmXCodeObject::PrintString(std::ostream& os,cmStdString String)
{
// The string needs to be quoted if it contains any characters
// considered special by the Xcode project file parser.
bool needQuote =
- (this->String.empty() ||
- this->String.find_first_of(" <>.+-=@$") != this->String.npos);
+ (String.empty() ||
+ String.find_first_of(" <>.+-=@$[]") != String.npos);
const char* quote = needQuote? "\"" : "";
// Print the string, quoted and escaped as necessary.
os << quote;
- for(std::string::const_iterator i = this->String.begin();
- i != this->String.end(); ++i)
+ for(std::string::const_iterator i = String.begin();
+ i != String.end(); ++i)
{
if(*i == '"')
{
@@ -254,6 +259,11 @@ void cmXCodeObject::PrintString(std::ostream& os) const
os << quote;
}
+void cmXCodeObject::PrintString(std::ostream& os) const
+{
+ cmXCodeObject::PrintString(os,this->String);
+}
+
//----------------------------------------------------------------------------
void cmXCodeObject::SetString(const char* s)
{