summaryrefslogtreecommitdiffstats
path: root/Source
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
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')
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/cmGlobalXCode21Generator.cxx52
-rw-r--r--Source/cmGlobalXCode21Generator.h41
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx39
-rw-r--r--Source/cmGlobalXCodeGenerator.h7
5 files changed, 30 insertions, 111 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index eb1caaf..3849e9f 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -251,8 +251,6 @@ IF(APPLE)
cmXCode21Object.cxx
cmGlobalXCodeGenerator.cxx
cmGlobalXCodeGenerator.h
- cmGlobalXCode21Generator.cxx
- cmGlobalXCode21Generator.h
cmLocalXCodeGenerator.cxx
cmLocalXCodeGenerator.h)
ENDIF(APPLE)
diff --git a/Source/cmGlobalXCode21Generator.cxx b/Source/cmGlobalXCode21Generator.cxx
deleted file mode 100644
index 3d55ca1..0000000
--- a/Source/cmGlobalXCode21Generator.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*=========================================================================
-
- Program: CMake - Cross-Platform Makefile Generator
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
- Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
- See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-#include "cmGlobalXCode21Generator.h"
-#include "cmXCode21Object.h"
-
-//----------------------------------------------------------------------------
-cmGlobalXCode21Generator::cmGlobalXCode21Generator()
-{
- this->XcodeVersion = 21;
-}
-
-//----------------------------------------------------------------------------
-void
-cmGlobalXCode21Generator::WriteXCodePBXProj(std::ostream& fout,
- cmLocalGenerator* ,
- std::vector<cmLocalGenerator*>& )
-{
- fout << "// !$*UTF8*$!\n";
- fout << "{\n";
- cmXCode21Object::Indent(1, fout);
- fout << "archiveVersion = 1;\n";
- cmXCode21Object::Indent(1, fout);
- fout << "classes = {\n";
- cmXCode21Object::Indent(1, fout);
- fout << "};\n";
- cmXCode21Object::Indent(1, fout);
- 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);
- cmXCode21Object::Indent(1, fout);
- fout << "rootObject = " << this->RootObject->GetId()
- << " /* Project object */;\n";
- fout << "}\n";
-}
diff --git a/Source/cmGlobalXCode21Generator.h b/Source/cmGlobalXCode21Generator.h
deleted file mode 100644
index 3a1b00e..0000000
--- a/Source/cmGlobalXCode21Generator.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
- Program: CMake - Cross-Platform Makefile Generator
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
-
- Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
- See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-#ifndef cmGlobalXCode21Generator_h
-#define cmGlobalXCode21Generator_h
-
-#include "cmGlobalXCodeGenerator.h"
-
-/** \class cmGlobalXCode21Generator
- * \brief Write Mac XCode projects
- *
- * cmGlobalXCode21Generator manages UNIX build process for a tree
- */
-class cmGlobalXCode21Generator : public cmGlobalXCodeGenerator
-{
-public:
- cmGlobalXCode21Generator();
- static cmGlobalGenerator* New() { return new cmGlobalXCode21Generator; }
- virtual void WriteXCodePBXProj(std::ostream& fout,
- cmLocalGenerator* root,
- std::vector<cmLocalGenerator*>& generators);
-
- ///! What is the configurations directory variable called?
- virtual const char* GetCMakeCFGInitDirectory() {
- return "$(CONFIGURATION)"; }
-};
-
-#endif
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
{
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 03082d2..3dd105c 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -80,7 +80,7 @@ public:
std::string& dir);
///! What is the configurations directory variable called?
- virtual const char* GetCMakeCFGInitDirectory() { return "."; }
+ virtual const char* GetCMakeCFGInitDirectory();
void GetTargetObjectFileDirectories(cmTarget* target,
std::vector<std::string>&
@@ -149,9 +149,8 @@ private:
std::vector<cmLocalGenerator*>& generators);
void OutputXCodeProject(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
- virtual void WriteXCodePBXProj(std::ostream& fout,
- cmLocalGenerator* root,
- std::vector<cmLocalGenerator*>& generators);
+ void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root,
+ std::vector<cmLocalGenerator*>& generators);
cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf,
cmTarget& cmtarget);
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,