summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-09-05 19:51:19 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-09-05 19:51:19 (GMT)
commit58be1b005f6dc0122a1fcce4e2c1dc977df6e623 (patch)
tree29cae1944a5a826a96e60756ca0343a35f6a15ac /Source/cmGlobalXCodeGenerator.cxx
parente3dda17db2fd4c02dbcb50baccd994830b91b0f0 (diff)
downloadCMake-58be1b005f6dc0122a1fcce4e2c1dc977df6e623.zip
CMake-58be1b005f6dc0122a1fcce4e2c1dc977df6e623.tar.gz
CMake-58be1b005f6dc0122a1fcce4e2c1dc977df6e623.tar.bz2
BUG: Fix issue #7046 - make sure extensionless headers and resource files work with the Xcode generator. Also fix incorrect mappings in the lastKnownFileType code. Add some extensionless files to the Framework test.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx48
1 files changed, 31 insertions, 17 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index f9d4445..442152a 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -526,11 +526,13 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
buildFile->AddAttribute("settings", settings);
fileRef->AddAttribute("fileEncoding", this->CreateString("4"));
+
const char* lang =
this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
std::string sourcecode = "sourcecode";
std::string ext = sf->GetExtension();
ext = cmSystemTools::LowerCase(ext);
+
if(ext == "o")
{
sourcecode = "compiled.mach-o.objfile";
@@ -541,41 +543,50 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
}
else if(ext == "m")
{
- sourcecode += ".cpp.objc";
+ sourcecode += ".c.objc";
}
else if(ext == "plist")
{
sourcecode += ".text.plist";
}
- else if(!lang)
+ else if(ext == "h" || ext == "hxx" || ext == "hpp")
{
- sourcecode += ext;
- sourcecode += ".";
- sourcecode += ext;
- }
- else if(strcmp(lang, "C") == 0)
- {
- sourcecode += ".c.c";
+ const char* linkLanguage = cmtarget.GetLinkerLanguage(this);
+ if(linkLanguage && (std::string(linkLanguage) == "CXX"))
+ {
+ sourcecode += ".cpp.h";
+ }
+ else
+ {
+ sourcecode += ".c.h";
+ }
}
- else if(strcmp(lang, "CXX") == 0)
+ else if(lang && strcmp(lang, "CXX") == 0)
{
sourcecode += ".cpp.cpp";
}
- else
+ else if(lang && strcmp(lang, "C") == 0)
{
- sourcecode += ext;
- sourcecode += ".";
- sourcecode += ext;
+ sourcecode += ".c.c";
}
+ //else
+ // {
+ // // Already specialized above or we leave sourcecode == "sourcecode"
+ // // which is probably the most correct choice. Extensionless headers,
+ // // for example... Or file types unknown to Xcode that do not map to a
+ // // valid lastKnownFileType value.
+ // }
+
fileRef->AddAttribute("lastKnownFileType",
this->CreateString(sourcecode.c_str()));
- std::string path =
+
+ std::string path =
this->ConvertToRelativeForXCode(sf->GetFullPath().c_str());
std::string dir;
std::string file;
cmSystemTools::SplitProgramPath(sf->GetFullPath().c_str(),
dir, file);
-
+
fileRef->AddAttribute("name", this->CreateString(file.c_str()));
fileRef->AddAttribute("path", this->CreateString(path.c_str()));
if(this->XcodeVersion == 15)
@@ -590,6 +601,7 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
{
fileRef->AddAttribute("sourceTree", this->CreateString("<absolute>"));
}
+
return buildFile;
}
@@ -693,7 +705,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
{
externalObjFiles.push_back(xsf);
}
- else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY"))
+ else if((*i)->GetPropertyAsBool("HEADER_FILE_ONLY") ||
+ (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) ||
+ (tsFlags.Type == cmTarget::SourceFileTypePublicHeader))
{
headerFiles.push_back(xsf);
}