summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-07-22 15:14:23 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-07-22 15:14:23 (GMT)
commit17d707254d03696b19ccb56cd2742b442ddb2825 (patch)
treea2bbcc01f243ae9351d38b4aa3e829becfab7915
parent7328a3848097dce73043adbe4416774c861ff507 (diff)
downloadCMake-17d707254d03696b19ccb56cd2742b442ddb2825.zip
CMake-17d707254d03696b19ccb56cd2742b442ddb2825.tar.gz
CMake-17d707254d03696b19ccb56cd2742b442ddb2825.tar.bz2
BUG: Fix issue #8481 - generate Xcode projects such that breakpoints may be used from the Xcode debugger without adjusting any settings within the Xcode GUI first... Thanks to Doug Gregor for the patch.
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx37
1 files changed, 34 insertions, 3 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 353fa6e..8bbc8fe 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -672,6 +672,23 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
cmSystemTools::SplitProgramPath(sf->GetFullPath().c_str(),
dir, file);
+ // Try to make the path relative to the project root.
+ bool Absolute = true;
+ if (this->XcodeVersion >= 30)
+ {
+ std::string relative =
+ this->CurrentLocalGenerator->Convert(sf->GetFullPath().c_str(),
+ cmLocalGenerator::HOME,
+ cmLocalGenerator::MAKEFILE,
+ false);
+ relative = cmSystemTools::ConvertToOutputPath(relative.c_str());
+ if (!relative.empty() && relative[0] != '/')
+ {
+ Absolute = false;
+ path = relative;
+ }
+ }
+
fileRef->AddAttribute("name", this->CreateString(file.c_str()));
fileRef->AddAttribute("path", this->CreateString(path.c_str()));
if(this->XcodeVersion == 15)
@@ -682,10 +699,14 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
{
fileRef->AddAttribute("sourceTree", this->CreateString("<group>"));
}
- else
+ else if (Absolute)
{
fileRef->AddAttribute("sourceTree", this->CreateString("<absolute>"));
}
+ else
+ {
+ fileRef->AddAttribute("sourceTree", this->CreateString("SOURCE_ROOT"));
+ }
return fileRef;
}
@@ -2581,8 +2602,18 @@ void cmGlobalXCodeGenerator
{
std::string proot = root->GetMakefile()->GetCurrentDirectory();
proot = this->ConvertToRelativeForXCode(proot.c_str());
- this->RootObject->AddAttribute("projectRoot",
- this->CreateString(proot.c_str()));
+ if (this->XcodeVersion >= 30)
+ {
+ this->RootObject->AddAttribute("projectRoot",
+ this->CreateString(""));
+ this->RootObject->AddAttribute("projectDirPath",
+ this->CreateString(proot.c_str()));
+ }
+ else
+ {
+ this->RootObject->AddAttribute("projectRoot",
+ this->CreateString(proot.c_str()));
+ }
}
cmXCodeObject* configlist =
this->CreateObject(cmXCodeObject::XCConfigurationList);