summaryrefslogtreecommitdiffstats
path: root/Source/cmXCodeObject.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-11-16 18:13:39 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-11-16 18:13:39 (GMT)
commit8b7091a0a6a056278f17a57b96c4694b43dc7bbb (patch)
tree216ffff95de69f389a54797b6b296040a18391d3 /Source/cmXCodeObject.cxx
parent7a1745b84bb5c3c9325b17e3a346b9a79f227efc (diff)
downloadCMake-8b7091a0a6a056278f17a57b96c4694b43dc7bbb.zip
CMake-8b7091a0a6a056278f17a57b96c4694b43dc7bbb.tar.gz
CMake-8b7091a0a6a056278f17a57b96c4694b43dc7bbb.tar.bz2
ENH: fixes for xcode21 and build styles and comments in the generated project
Diffstat (limited to 'Source/cmXCodeObject.cxx')
-rw-r--r--Source/cmXCodeObject.cxx94
1 files changed, 74 insertions, 20 deletions
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 02cf977..2fddf66 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -14,12 +14,14 @@ const char* cmXCodeObject::PBXTypeNames[] = {
cmXCodeObject::~cmXCodeObject()
{
+ m_Version = 15;
}
//----------------------------------------------------------------------------
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
{
+ m_Version = 15;
m_PBXTargetDependency = 0;
m_cmTarget = 0;
m_Object =0;
@@ -67,56 +69,84 @@ void cmXCodeObject::Indent(int level, std::ostream& out)
//----------------------------------------------------------------------------
void cmXCodeObject::Print(std::ostream& out)
{
- cmXCodeObject::Indent(2, out);
+ std::string separator = "\n";
+ int indentFactor = 1;
+ if(m_Version > 15 && (m_IsA == PBXFileReference || m_IsA == PBXBuildFile))
+ {
+ separator = " ";
+ indentFactor = 0;
+ }
+ cmXCodeObject::Indent(2*indentFactor, out);
out << m_Id << " ";
- this->PrintComment(out);
- out << " = {\n";
+ if(!(this->m_IsA == PBXGroup && this->m_Comment.size() == 0))
+ {
+ this->PrintComment(out);
+ }
+ out << " = {";
+ if(separator == "\n")
+ {
+ out << separator;
+ }
std::map<cmStdString, cmXCodeObject*>::iterator i;
+ cmXCodeObject::Indent(3*indentFactor, out);
+ out << "isa = " << PBXTypeNames[m_IsA] << ";" << separator;
for(i = m_ObjectAttributes.begin(); i != m_ObjectAttributes.end(); ++i)
{
cmXCodeObject* object = i->second;
- cmXCodeObject::Indent(3, out);
- if(i->first == "isa")
+ if(i->first != "isa")
{
- out << i->first << " = " << PBXTypeNames[m_IsA] << ";\n";
+ cmXCodeObject::Indent(3*indentFactor, out);
}
- else if(object->m_Type == OBJECT_LIST)
+ else
+ {
+ continue;
+ }
+ if(object->m_Type == OBJECT_LIST)
{
- out << i->first << " = (\n";
+ out << i->first << " = (" << separator;
for(unsigned int k = 0; k < i->second->m_List.size(); k++)
{
- cmXCodeObject::Indent(4, out);
- out << i->second->m_List[k]->m_Id << ",\n";
+ cmXCodeObject::Indent(4*indentFactor, out);
+ out << i->second->m_List[k]->m_Id << " ";
+ i->second->m_List[k]->PrintComment(out);
+ out << "," << separator;
}
- cmXCodeObject::Indent(3, out);
- out << ");\n";
+ cmXCodeObject::Indent(3*indentFactor, out);
+ out << ");" << separator;
}
else if(object->m_Type == ATTRIBUTE_GROUP)
{
std::map<cmStdString, cmXCodeObject*>::iterator j;
- out << i->first << " = {\n";
+ out << i->first << " = {" << separator;
for(j = object->m_ObjectAttributes.begin(); j != object->m_ObjectAttributes.end(); ++j)
{
- cmXCodeObject::Indent(4, out);
- out << j->first << " = " << j->second->m_String << ";\n";
+ cmXCodeObject::Indent(4 *indentFactor, out);
+ out << j->first << " = " << j->second->m_String << ";";
+ out << separator;
}
- cmXCodeObject::Indent(3, out);
- out << "};\n";
+ cmXCodeObject::Indent(3 *indentFactor, out);
+ out << "};" << separator;
}
else if(object->m_Type == OBJECT_REF)
{
- out << i->first << " = " << object->m_Object->m_Id << ";\n";
+ out << i->first << " = " << object->m_Object->m_Id;
+ if(object->m_Object->HasComment() && i->first != "remoteGlobalIDString")
+ {
+ out << " ";
+ object->m_Object->PrintComment(out);
+ }
+ out << ";" << separator;
}
else if(object->m_Type == STRING)
{
- out << i->first << " = " << object->m_String << ";\n";
+ out << i->first << " = " << object->m_String << ";" << separator;
}
else
{
out << "what is this?? " << i->first << "\n";
}
}
- cmXCodeObject::Indent(2, out);
+ cmXCodeObject::Indent(2*indentFactor, out);
out << "};\n";
}
@@ -146,3 +176,27 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy)
this->m_Object = copy->m_Object;
}
+void cmXCodeObject::SetString(const char* s)
+{
+ std::string ss = s;
+ if(ss.size() == 0)
+ {
+ m_String = "\"\"";
+ return;
+ }
+ bool needQuote = false;
+ m_String = "";
+ if(ss.find_first_of(" <>.+") != ss.npos)
+ {
+ needQuote = true;
+ }
+ if(needQuote)
+ {
+ m_String = "\"";
+ }
+ m_String += s;
+ if(needQuote)
+ {
+ m_String += "\"";
+ }
+}