summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx59
1 files changed, 41 insertions, 18 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6628cfc..23fad51 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -24,7 +24,7 @@
#include "cmXCodeObject.h"
#include "cmake.h"
-#include <cmsys/auto_ptr.hxx>
+#include <cm_auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmXMLParser.h"
@@ -108,20 +108,21 @@ public:
class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
{
public:
- virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
- cmake* cm) const;
+ cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
+ cmake* cm) const CM_OVERRIDE;
- virtual void GetDocumentation(cmDocumentationEntry& entry) const
+ void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
{
cmGlobalXCodeGenerator::GetDocumentation(entry);
}
- virtual void GetGenerators(std::vector<std::string>& names) const
+ void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
{
names.push_back(cmGlobalXCodeGenerator::GetActualName());
}
- virtual bool SupportsToolset() const { return true; }
+ bool SupportsToolset() const CM_OVERRIDE { return true; }
+ bool SupportsPlatform() const CM_OVERRIDE { return false; }
};
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm,
@@ -175,7 +176,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
parser.ParseFile(
"/Developer/Applications/Xcode.app/Contents/version.plist");
}
- cmsys::auto_ptr<cmGlobalXCodeGenerator> gg(
+ CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
new cmGlobalXCodeGenerator(cm, parser.Version));
if (gg->XcodeVersion == 20) {
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
@@ -659,7 +660,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
// Add flags from target and source file properties.
std::string flags;
const char* srcfmt = sf->GetProperty("Fortran_FORMAT");
- switch (this->CurrentLocalGenerator->GetFortranFormat(srcfmt)) {
+ switch (cmOutputConverter::GetFortranFormat(srcfmt)) {
case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags;
break;
@@ -689,7 +690,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
cmXCodeObject* fileRef = buildFile->GetObject("fileRef")->GetObject();
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
- settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags));
+ settings->AddAttributeIfNotEmpty("COMPILER_FLAGS",
+ this->CreateString(flags));
// Is this a resource file in this target? Add it to the resources group...
//
@@ -698,23 +700,37 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
gtgt->GetTargetSourceFileFlags(sf);
bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource;
+ cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+
// Is this a "private" or "public" framework header file?
// Set the ATTRIBUTES attribute appropriately...
//
if (gtgt->IsFrameworkOnApple()) {
if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) {
- cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
attrs->AddObject(this->CreateString("Private"));
- settings->AddAttribute("ATTRIBUTES", attrs);
isResource = true;
} else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) {
- cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
attrs->AddObject(this->CreateString("Public"));
- settings->AddAttribute("ATTRIBUTES", attrs);
isResource = true;
}
}
+ // Add user-specified file attributes.
+ const char* extraFileAttributes = sf->GetProperty("XCODE_FILE_ATTRIBUTES");
+ if (extraFileAttributes) {
+ // Expand the list of attributes.
+ std::vector<std::string> attributes;
+ cmSystemTools::ExpandListArgument(extraFileAttributes, attributes);
+
+ // Store the attributes.
+ for (std::vector<std::string>::const_iterator ai = attributes.begin();
+ ai != attributes.end(); ++ai) {
+ attrs->AddObject(this->CreateString(*ai));
+ }
+ }
+
+ settings->AddAttributeIfNotEmpty("ATTRIBUTES", attrs);
+
// Add the fileRef to the top level Resources group/folder if it is not
// already there.
//
@@ -723,7 +739,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
this->ResourcesGroupChildren->AddObject(fileRef);
}
- buildFile->AddAttribute("settings", settings);
+ buildFile->AddAttributeIfNotEmpty("settings", settings);
return buildFile;
}
@@ -772,6 +788,8 @@ std::string GetSourcecodeValueFromFileExtension(const std::string& _ext,
sourcecode += ".asm";
} else if (ext == "metal") {
sourcecode += ".metal";
+ } else if (ext == "mig") {
+ sourcecode += ".mig";
}
// else
// {
@@ -1544,7 +1562,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
std::string echo_cmd = "echo ";
echo_cmd += (this->CurrentLocalGenerator->EscapeForShell(
comment, ccg.GetCC().GetEscapeAllowMakeVars()));
- makefileStream << "\t" << echo_cmd.c_str() << "\n";
+ makefileStream << "\t" << echo_cmd << "\n";
}
// Add each command line to the set of commands.
@@ -1562,7 +1580,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
}
cmd += cmd2;
ccg.AppendArguments(c, cmd);
- makefileStream << "\t" << cmd.c_str() << "\n";
+ makefileStream << "\t" << cmd << "\n";
}
}
}
@@ -1784,6 +1802,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
extraLinkOptions += " ";
extraLinkOptions += createFlags;
}
+ const char* ext = gtgt->GetProperty("BUNDLE_EXTENSION");
+ if (ext) {
+ buildSettings->AddAttribute("WRAPPER_EXTENSION",
+ this->CreateString(ext));
+ }
std::string plist = this->ComputeInfoPListLocation(gtgt);
// Xcode will create the final version of Info.plist at build time,
// so let it replace the cfbundle name. This avoids creating
@@ -1981,7 +2004,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Add Fortran source format attribute if property is set.
const char* format = 0;
const char* tgtfmt = gtgt->GetProperty("Fortran_FORMAT");
- switch (this->CurrentLocalGenerator->GetFortranFormat(tgtfmt)) {
+ switch (cmOutputConverter::GetFortranFormat(tgtfmt)) {
case cmOutputConverter::FortranFormatFixed:
format = "fixed";
break;
@@ -3437,7 +3460,7 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(
// Return true if the generated build tree may contain multiple builds.
// i.e. "Can I build Debug and Release in the same tree?"
-bool cmGlobalXCodeGenerator::IsMultiConfig()
+bool cmGlobalXCodeGenerator::IsMultiConfig() const
{
// Old Xcode 1.5 is single config:
if (this->XcodeVersion == 15) {