ENH: fixes for Xcode 2.2

This commit is contained in:
Bill Hoffman 2005-11-18 14:12:09 -05:00
parent c0ee3a13a5
commit 47622dde01
2 changed files with 154 additions and 131 deletions

View File

@ -93,8 +93,9 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New()
"using Xcode 15 generator\n");
return new cmGlobalXCodeGenerator;
}
return new cmGlobalXCode21Generator;
cmGlobalXCodeGenerator* ret = new cmGlobalXCode21Generator;
ret->SetVersion(parser.m_Version);
return ret;
#else
std::cerr
<< "CMake should be built with cmake to use XCode, default to Xcode 1.5\n";
@ -517,9 +518,6 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
this->CreateString(sourcecode.c_str()));
std::string path =
this->ConvertToRelativeForXCode(sf->GetFullPath().c_str());
// std::string file =
// cmSystemTools::RelativePath(m_CurrentMakefile->GetHomeDirectory(),
// sf->GetFullPath().c_str());
std::string dir;
std::string file;
cmSystemTools::SplitProgramPath(sf->GetFullPath().c_str(),
@ -998,7 +996,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
cmSystemTools::ReplaceString(defFlags, "\"", "\\\"");
cmSystemTools::ReplaceString(flags, "\"", "\\\"");
cmSystemTools::ReplaceString(cflags, "\"", "\\\"");
if(m_XcodeVersion == 21)
if(m_XcodeVersion > 15)
{
defFlags += " -DCMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\" ";
}
@ -1044,10 +1042,31 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
std::string t = "lib";
t += productName;
productName = t;
if(m_XcodeVersion >= 22)
{
buildSettings->AddAttribute("MACH_O_TYPE",
this->CreateString("mh_bundle"));
buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_SYMBOLS_PRIVATE_EXTERN",
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
std::string outflag = "-o \\\"$(CONFIGURATION_BUILD_DIR)/";
outflag += productName;
outflag += "\\\"";
buildSettings->AddAttribute("OTHER_LDFLAGS",
this->CreateString(outflag.c_str()));
productType = "com.apple.product-type.tool";
fileType = "compiled.mach-o.executable";
}
else
{
buildSettings->AddAttribute("OTHER_LDFLAGS",
this->CreateString("-bundle"));
productType = "com.apple.product-type.library.dynamic";
fileType = "compiled.mach-o.dylib";
}
break;
}
case cmTarget::SHARED_LIBRARY:
@ -1199,8 +1218,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
buildSettings->AddAttribute("OTHER_CFLAGS",
this->CreateString(flags.c_str()));
}
if(!buildSettings->GetObject("OTHER_LDFLAGS"))
{
buildSettings->AddAttribute("OTHER_LDFLAGS",
this->CreateString(""));
}
buildSettings->AddAttribute("OTHER_REZFLAGS",
this->CreateString(""));
buildSettings->AddAttribute("SECTORDER_FLAGS",
@ -1523,7 +1545,7 @@ std::string cmGlobalXCodeGenerator::GetTargetFullPath(cmTarget* target)
cmXCodeObject* xtarget = this->FindXCodeTarget(target);
cmXCodeObject* bset = xtarget->GetObject("buildSettings");
cmXCodeObject* spath = bset->GetObject("SYMROOT");
if(m_XcodeVersion == 21)
if(m_XcodeVersion > 15)
{
libPath += "$(CONFIGURATION)/";
}
@ -1601,7 +1623,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
{
if(libDir->size() && *libDir != "/usr/lib")
{
if(m_XcodeVersion == 21)
if(m_XcodeVersion > 15)
{
// now add the same one but append $(CONFIGURATION) to it:
linkDirs += " ";

View File

@ -36,6 +36,7 @@ public:
cmGlobalXCodeGenerator();
static cmGlobalGenerator* New();
void SetVersion(int v) { m_XcodeVersion = v;}
///! Get the name for the generator.
virtual const char* GetName() const {
return cmGlobalXCodeGenerator::GetActualName();}