summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-19 16:00:09 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-19 16:00:09 (GMT)
commitd4cfb77ffe816f71d456dc70ab18efb7eb19d82d (patch)
tree87908f67a85c448de02380c7078db623084ead8a /Source/cmGlobalXCodeGenerator.cxx
parent180c60a86f5c44085a1a66865bfc8b9479c72e8a (diff)
downloadCMake-d4cfb77ffe816f71d456dc70ab18efb7eb19d82d.zip
CMake-d4cfb77ffe816f71d456dc70ab18efb7eb19d82d.tar.gz
CMake-d4cfb77ffe816f71d456dc70ab18efb7eb19d82d.tar.bz2
Remove cmGlobalXCode21Generator subclass
This subclass of cmGlobalXCodeGenerator only provided two virtual method overrides, and it made construction of the Xcode generator instance complicated. This commit removes it and replaces the virtual methods with tests of the Xcode version. The change removes duplicate code.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx39
1 files changed, 27 insertions, 12 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index ec34197..9ba2497 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -15,7 +15,6 @@ PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "cmGlobalXCodeGenerator.h"
-#include "cmGlobalXCode21Generator.h"
#include "cmLocalXCodeGenerator.h"
#include "cmMakefile.h"
#include "cmXCodeObject.h"
@@ -25,6 +24,8 @@ PURPOSE. See the above copyright notices for more information.
#include "cmComputeLinkInformation.h"
#include "cmSourceFile.h"
+#include <cmsys/auto_ptr.hxx>
+
//----------------------------------------------------------------------------
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmXMLParser.h"
@@ -133,19 +134,14 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New()
cmXcodeVersionParser parser;
parser.ParseFile
("/Developer/Applications/Xcode.app/Contents/version.plist");
- if(parser.Version == 15)
- {
- return new cmGlobalXCodeGenerator;
- }
- else if (parser.Version == 20)
+ cmsys::auto_ptr<cmGlobalXCodeGenerator> gg(new cmGlobalXCodeGenerator);
+ if (parser.Version == 20)
{
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
"using Xcode 15 generator\n");
- return new cmGlobalXCodeGenerator;
}
- cmGlobalXCodeGenerator* ret = new cmGlobalXCode21Generator;
- ret->SetVersion(parser.Version);
- return ret;
+ gg->SetVersion(parser.Version);
+ return gg.release();
#else
std::cerr << "CMake should be built with cmake to use XCode, "
"default to Xcode 1.5\n";
@@ -2998,14 +2994,33 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::Indent(1, fout);
fout << "};\n";
cmXCodeObject::Indent(1, fout);
- fout << "objectVersion = 39;\n";
- cmXCodeObject::PrintList(this->XCodeObjects, fout);
+ if(this->XcodeVersion >= 21)
+ {
+ if (this->XcodeVersion >= 31)
+ fout << "objectVersion = 45;\n";
+ else if (this->XcodeVersion >= 30)
+ fout << "objectVersion = 44;\n";
+ else
+ fout << "objectVersion = 42;\n";
+ cmXCode21Object::PrintList(this->XCodeObjects, fout);
+ }
+ else
+ {
+ fout << "objectVersion = 39;\n";
+ cmXCodeObject::PrintList(this->XCodeObjects, fout);
+ }
cmXCodeObject::Indent(1, fout);
fout << "rootObject = " << this->RootObject->GetId() << ";\n";
fout << "}\n";
}
//----------------------------------------------------------------------------
+const char* cmGlobalXCodeGenerator::GetCMakeCFGInitDirectory()
+{
+ return this->XcodeVersion >= 21? "$(CONFIGURATION)" : ".";
+}
+
+//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry)
const
{