STYLE: fix line length

This commit is contained in:
Ken Martin 2006-05-11 15:39:46 -04:00
parent b1b1973736
commit 80f71359c1
2 changed files with 113 additions and 75 deletions

View File

@ -207,7 +207,8 @@ void cmGlobalXCodeGenerator::ConfigureOutputPaths()
this->CurrentMakefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); this->CurrentMakefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH");
if(this->LibraryOutputPath.size() == 0) if(this->LibraryOutputPath.size() == 0)
{ {
this->LibraryOutputPath = this->CurrentMakefile->GetCurrentOutputDirectory(); this->LibraryOutputPath =
this->CurrentMakefile->GetCurrentOutputDirectory();
} }
// make sure there is a trailing slash // make sure there is a trailing slash
if(this->LibraryOutputPath.size() && if(this->LibraryOutputPath.size() &&
@ -225,7 +226,8 @@ void cmGlobalXCodeGenerator::ConfigureOutputPaths()
this->CurrentMakefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); this->CurrentMakefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
if(this->ExecutableOutputPath.size() == 0) if(this->ExecutableOutputPath.size() == 0)
{ {
this->ExecutableOutputPath = this->CurrentMakefile->GetCurrentOutputDirectory(); this->ExecutableOutputPath =
this->CurrentMakefile->GetCurrentOutputDirectory();
} }
// make sure there is a trailing slash // make sure there is a trailing slash
if(this->ExecutableOutputPath.size() && if(this->ExecutableOutputPath.size() &&
@ -260,7 +262,8 @@ void cmGlobalXCodeGenerator::Generate()
this->CurrentProject = root->GetMakefile()->GetProjectName(); this->CurrentProject = root->GetMakefile()->GetProjectName();
this->SetCurrentLocalGenerator(root); this->SetCurrentLocalGenerator(root);
this->OutputDir = this->CurrentMakefile->GetHomeOutputDirectory(); this->OutputDir = this->CurrentMakefile->GetHomeOutputDirectory();
this->OutputDir = cmSystemTools::CollapseFullPath(this->OutputDir.c_str()); this->OutputDir =
cmSystemTools::CollapseFullPath(this->OutputDir.c_str());
cmSystemTools::SplitPath(this->OutputDir.c_str(), cmSystemTools::SplitPath(this->OutputDir.c_str(),
this->ProjectOutputDirectoryComponents); this->ProjectOutputDirectoryComponents);
this->CurrentLocalGenerator = root; this->CurrentLocalGenerator = root;
@ -358,7 +361,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(cmLocalGenerator* root)
this->CurrentReRunCMakeMakefile += "/CMakeScripts"; this->CurrentReRunCMakeMakefile += "/CMakeScripts";
cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str()); cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str());
this->CurrentReRunCMakeMakefile += "/ReRunCMake.make"; this->CurrentReRunCMakeMakefile += "/ReRunCMake.make";
cmGeneratedFileStream makefileStream(this->CurrentReRunCMakeMakefile.c_str()); cmGeneratedFileStream makefileStream
(this->CurrentReRunCMakeMakefile.c_str());
makefileStream.SetCopyIfDifferent(true); makefileStream.SetCopyIfDifferent(true);
makefileStream << "# Generated by CMake, DO NOT EDIT\n"; makefileStream << "# Generated by CMake, DO NOT EDIT\n";
makefileStream << "CMakeFiles/cmake.check_cache: "; makefileStream << "CMakeFiles/cmake.check_cache: ";
@ -425,7 +429,8 @@ cmGlobalXCodeGenerator::CreateString(const char* s)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmXCodeObject* cmGlobalXCodeGenerator::CreateObjectReference(cmXCodeObject* ref) cmXCodeObject* cmGlobalXCodeGenerator
::CreateObjectReference(cmXCodeObject* ref)
{ {
cmXCodeObject* obj = this->CreateObject(cmXCodeObject::OBJECT_REF); cmXCodeObject* obj = this->CreateObject(cmXCodeObject::OBJECT_REF);
obj->SetObject(ref); obj->SetObject(ref);
@ -445,7 +450,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
lg->AppendFlags(flags, cmtarget.GetProperty("COMPILE_FLAGS")); lg->AppendFlags(flags, cmtarget.GetProperty("COMPILE_FLAGS"));
} }
lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS")); lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS"));
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); cmXCodeObject* fileRef =
this->CreateObject(cmXCodeObject::PBXFileReference);
cmXCodeObject* group = this->GroupMap[sf]; cmXCodeObject* group = this->GroupMap[sf];
cmXCodeObject* children = group->GetObject("children"); cmXCodeObject* children = group->GetObject("children");
@ -461,7 +467,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
buildFile->SetComment(comment.c_str()); buildFile->SetComment(comment.c_str());
fileRef->SetComment(fname.c_str()); fileRef->SetComment(fname.c_str());
buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef)); buildFile->AddAttribute("fileRef", this->CreateObjectReference(fileRef));
cmXCodeObject* settings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); cmXCodeObject* settings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str())); settings->AddAttribute("COMPILER_FLAGS", this->CreateString(flags.c_str()));
buildFile->AddAttribute("settings", settings); buildFile->AddAttribute("settings", settings);
fileRef->AddAttribute("fileEncoding", this->CreateString("4")); fileRef->AddAttribute("fileEncoding", this->CreateString("4"));
@ -551,7 +558,8 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
std::string outdir = std::string outdir =
cmSystemTools::CollapseFullPath(this->CurrentMakefile-> cmSystemTools::CollapseFullPath(this->CurrentMakefile->
GetCurrentOutputDirectory()); GetCurrentOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(), this->CurrentOutputDirectoryComponents); cmSystemTools::SplitPath(outdir.c_str(),
this->CurrentOutputDirectoryComponents);
// Select the current set of configuration types. // Select the current set of configuration types.
this->CurrentConfigurationTypes.clear(); this->CurrentConfigurationTypes.clear();
@ -560,7 +568,8 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
if(const char* types = if(const char* types =
this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES")) this->CurrentMakefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{ {
cmSystemTools::ExpandListArgument(types, this->CurrentConfigurationTypes); cmSystemTools::ExpandListArgument(types,
this->CurrentConfigurationTypes);
} }
} }
if(this->CurrentConfigurationTypes.empty()) if(this->CurrentConfigurationTypes.empty())
@ -613,7 +622,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
sourceBuildPhase->AddAttribute("buildActionMask", sourceBuildPhase->AddAttribute("buildActionMask",
this->CreateString("2147483647")); this->CreateString("2147483647"));
sourceBuildPhase->SetComment("Sources"); sourceBuildPhase->SetComment("Sources");
cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* buildFiles =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
sourceBuildPhase->AddAttribute("files", buildFiles); sourceBuildPhase->AddAttribute("files", buildFiles);
sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
this->CreateString("0")); this->CreateString("0"));
@ -626,7 +636,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
i != classes.end(); ++i) i != classes.end(); ++i)
{ {
cmXCodeObject* xsf = cmXCodeObject* xsf =
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *i, cmtarget); this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
*i, cmtarget);
cmXCodeObject* fr = xsf->GetObject("fileRef"); cmXCodeObject* fr = xsf->GetObject("fileRef");
cmXCodeObject* filetype = cmXCodeObject* filetype =
fr->GetObject()->GetObject("lastKnownFileType"); fr->GetObject()->GetObject("lastKnownFileType");
@ -730,7 +741,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
for ( sfIt = mit->second.begin(); sfIt != mit->second.end(); ++ sfIt ) for ( sfIt = mit->second.begin(); sfIt != mit->second.end(); ++ sfIt )
{ {
cmXCodeObject* xsf = cmXCodeObject* xsf =
this->CreateXCodeSourceFile(this->CurrentLocalGenerator, *sfIt, cmtarget); this->CreateXCodeSourceFile(this->CurrentLocalGenerator,
*sfIt, cmtarget);
buildFiles->AddObject(xsf); buildFiles->AddObject(xsf);
} }
} }
@ -794,9 +806,9 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
} }
} }
std::vector<cmCustomCommand> reruncom; std::vector<cmCustomCommand> reruncom;
cmXCodeObject* cmakeReRunPhase = this->CreateBuildPhase("CMake ReRun", cmXCodeObject* cmakeReRunPhase =
"cmakeReRunPhase", this->CreateBuildPhase("CMake ReRun", "cmakeReRunPhase",
cmtarget, reruncom); cmtarget, reruncom);
buildPhases->AddObject(cmakeReRunPhase); buildPhases->AddObject(cmakeReRunPhase);
// create prebuild phase // create prebuild phase
cmXCodeObject* cmakeRulesBuildPhase = cmXCodeObject* cmakeRulesBuildPhase =
@ -804,17 +816,16 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
"cmakeRulesBuildPhase", "cmakeRulesBuildPhase",
cmtarget, commands); cmtarget, commands);
// create prebuild phase // create prebuild phase
cmXCodeObject* preBuildPhase = this->CreateBuildPhase("CMake PreBuild Rules", cmXCodeObject* preBuildPhase =
"preBuildCommands", this->CreateBuildPhase("CMake PreBuild Rules", "preBuildCommands",
cmtarget, prebuild); cmtarget, prebuild);
// create prebuild phase // create prebuild phase
cmXCodeObject* preLinkPhase = this->CreateBuildPhase("CMake PreLink Rules", cmXCodeObject* preLinkPhase =
"preLinkCommands", this->CreateBuildPhase("CMake PreLink Rules", "preLinkCommands",
cmtarget, prelink); cmtarget, prelink);
// create prebuild phase // create prebuild phase
cmXCodeObject* postBuildPhase = cmXCodeObject* postBuildPhase =
this->CreateBuildPhase("CMake PostBuild Rules", this->CreateBuildPhase("CMake PostBuild Rules", "postBuildPhase",
"postBuildPhase",
cmtarget, postbuild); cmtarget, postbuild);
// the order here is the order they will be built in // the order here is the order they will be built in
if(preBuildPhase) if(preBuildPhase)
@ -977,7 +988,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
// There are no outputs. Use the generated force rule name. // There are no outputs. Use the generated force rule name.
makefileStream << tname[&cc] << ": "; makefileStream << tname[&cc] << ": ";
} }
for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin(); for(std::vector<std::string>::const_iterator d =
cc.GetDepends().begin();
d != cc.GetDepends().end(); ++d) d != cc.GetDepends().end(); ++d)
{ {
if(!this->FindTarget(this->CurrentProject.c_str(), if(!this->FindTarget(this->CurrentProject.c_str(),
@ -1057,7 +1069,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
} }
makecmd += " all"; makecmd += " all";
cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ ");
buildphase->AddAttribute("shellScript", this->CreateString(makecmd.c_str())); buildphase->AddAttribute("shellScript",
this->CreateString(makecmd.c_str()));
} }
@ -1107,17 +1120,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
} }
// Add define flags // Add define flags
this->CurrentLocalGenerator->AppendFlags(defFlags, this->CurrentLocalGenerator->
this->CurrentMakefile->GetDefineFlags()); AppendFlags(defFlags,
this->CurrentMakefile->GetDefineFlags());
cmSystemTools::ReplaceString(defFlags, "\"", "\\\""); cmSystemTools::ReplaceString(defFlags, "\"", "\\\"");
cmSystemTools::ReplaceString(flags, "\"", "\\\""); cmSystemTools::ReplaceString(flags, "\"", "\\\"");
cmSystemTools::ReplaceString(cflags, "\"", "\\\""); cmSystemTools::ReplaceString(cflags, "\"", "\\\"");
if(this->XcodeVersion > 15) if(this->XcodeVersion > 15)
{ {
buildSettings-> buildSettings->AddAttribute
AddAttribute("GCC_PREPROCESSOR_DEFINITIONS", ("GCC_PREPROCESSOR_DEFINITIONS",
this->CreateString("CMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\"")); this->CreateString("CMAKE_INTDIR=\\\\\\\"$(CONFIGURATION)\\\\\\\""));
} }
std::string extraLinkOptions; std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE) if(target.GetType() == cmTarget::EXECUTABLE)
@ -1127,13 +1140,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
} }
if(target.GetType() == cmTarget::SHARED_LIBRARY) if(target.GetType() == cmTarget::SHARED_LIBRARY)
{ {
extraLinkOptions = extraLinkOptions = this->CurrentMakefile->
this->CurrentMakefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
} }
if(target.GetType() == cmTarget::MODULE_LIBRARY) if(target.GetType() == cmTarget::MODULE_LIBRARY)
{ {
extraLinkOptions = extraLinkOptions = this->CurrentMakefile->
this->CurrentMakefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
} }
const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); const char* targetLinkFlags = target.GetProperty("LINK_FLAGS");
@ -1495,7 +1508,8 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
buildSettings, fileTypeString, buildSettings, fileTypeString,
productTypeString, productName, globalConfig); productTypeString, productName, globalConfig);
target->AddAttribute("buildSettings", buildSettings); target->AddAttribute("buildSettings", buildSettings);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies); target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(productName.c_str())); target->AddAttribute("name", this->CreateString(productName.c_str()));
target->AddAttribute("productName",this->CreateString(productName.c_str())); target->AddAttribute("productName",this->CreateString(productName.c_str()));
@ -1507,12 +1521,14 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
cmTarget& cmtarget) cmTarget& cmtarget)
{ {
std::string configTypes = this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"); std::string configTypes =
this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES");
std::vector<std::string> configVectorIn; std::vector<std::string> configVectorIn;
std::vector<std::string> configVector; std::vector<std::string> configVector;
configVectorIn.push_back(configTypes); configVectorIn.push_back(configTypes);
cmSystemTools::ExpandList(configVectorIn, configVector); cmSystemTools::ExpandList(configVectorIn, configVector);
cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList); cmXCodeObject* configlist =
this->CreateObject(cmXCodeObject::XCConfigurationList);
cmXCodeObject* buildConfigurations = cmXCodeObject* buildConfigurations =
this->CreateObject(cmXCodeObject::OBJECT_LIST); this->CreateObject(cmXCodeObject::OBJECT_LIST);
configlist->AddAttribute("buildConfigurations", buildConfigurations); configlist->AddAttribute("buildConfigurations", buildConfigurations);
@ -1526,7 +1542,8 @@ void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
this->CreateObjectReference(configlist)); this->CreateObjectReference(configlist));
for(unsigned int i = 0; i < configVector.size(); ++i) for(unsigned int i = 0; i < configVector.size(); ++i)
{ {
cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
buildConfigurations->AddObject(config); buildConfigurations->AddObject(config);
cmXCodeObject* buildSettings = cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
@ -1545,7 +1562,8 @@ void cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
{ {
configlist->AddAttribute("defaultConfigurationName", configlist->AddAttribute("defaultConfigurationName",
this->CreateString(configVector[0].c_str())); this->CreateString(configVector[0].c_str()));
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0")); configlist->AddAttribute("defaultConfigurationIsVisible",
this->CreateString("0"));
} }
} }
@ -1577,12 +1595,14 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
buildSettings, fileTypeString, buildSettings, fileTypeString,
productTypeString, productName, globalConfig); productTypeString, productName, globalConfig);
target->AddAttribute("buildSettings", buildSettings); target->AddAttribute("buildSettings", buildSettings);
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("dependencies", dependencies); target->AddAttribute("dependencies", dependencies);
target->AddAttribute("name", this->CreateString(productName.c_str())); target->AddAttribute("name", this->CreateString(productName.c_str()));
target->AddAttribute("productName",this->CreateString(productName.c_str())); target->AddAttribute("productName",this->CreateString(productName.c_str()));
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference); cmXCodeObject* fileRef =
this->CreateObject(cmXCodeObject::PBXFileReference);
fileRef->AddAttribute("explicitFileType", fileRef->AddAttribute("explicitFileType",
this->CreateString(fileTypeString.c_str())); this->CreateString(fileTypeString.c_str()));
fileRef->AddAttribute("path", this->CreateString(productName.c_str())); fileRef->AddAttribute("path", this->CreateString(productName.c_str()));
@ -1629,7 +1649,8 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
// now avoid circular references if dependTarget already // now avoid circular references if dependTarget already
// depends on target then skip it. Circular references crashes // depends on target then skip it. Circular references crashes
// xcode // xcode
cmXCodeObject* dependTargetDepends = dependTarget->GetObject("dependencies"); cmXCodeObject* dependTargetDepends =
dependTarget->GetObject("dependencies");
if(dependTargetDepends) if(dependTargetDepends)
{ {
if(dependTargetDepends->HasObject(target->GetPBXTargetDependency())) if(dependTargetDepends->HasObject(target->GetPBXTargetDependency()))
@ -1700,10 +1721,11 @@ void cmGlobalXCodeGenerator::AppendOrAddBuildSetting(cmXCodeObject* settings,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(cmXCodeObject* target, void cmGlobalXCodeGenerator
const char* attribute, ::AppendBuildSettingAttribute(cmXCodeObject* target,
const char* value, const char* attribute,
const char* configName) const char* value,
const char* configName)
{ {
if(this->XcodeVersion < 21) if(this->XcodeVersion < 21)
{ {
@ -1716,12 +1738,15 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(cmXCodeObject* target,
{ {
// There are multiple configurations. Add the setting to the // There are multiple configurations. Add the setting to the
// buildSettings of the configuration name given. // buildSettings of the configuration name given.
cmXCodeObject* configurationList = target->GetObject("buildConfigurationList")->GetObject(); cmXCodeObject* configurationList =
cmXCodeObject* buildConfigs = configurationList->GetObject("buildConfigurations"); target->GetObject("buildConfigurationList")->GetObject();
cmXCodeObject* buildConfigs =
configurationList->GetObject("buildConfigurations");
std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList(); std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList();
// each configuration and the target itself has a buildSettings in it // each configuration and the target itself has a buildSettings in it
//list.push_back(target); //list.push_back(target);
for(std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end(); ++i) for(std::vector<cmXCodeObject*>::iterator i = list.begin();
i != list.end(); ++i)
{ {
if(configName) if(configName)
{ {
@ -1741,7 +1766,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(cmXCodeObject* target,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) void cmGlobalXCodeGenerator
::AddDependAndLinkInformation(cmXCodeObject* target)
{ {
cmTarget* cmtarget = target->GetTarget(); cmTarget* cmtarget = target->GetTarget();
if(!cmtarget) if(!cmtarget)
@ -1760,7 +1786,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
emitted.insert(cmtarget->GetName()); emitted.insert(cmtarget->GetName());
// Loop over all library dependencies. // Loop over all library dependencies.
const cmTarget::LinkLibraryVectorType& tlibs = cmtarget->GetLinkLibraries(); const cmTarget::LinkLibraryVectorType& tlibs =
cmtarget->GetLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib) lib != tlibs.end(); ++lib)
{ {
@ -1896,15 +1923,16 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{ {
cmTarget& cmtarget = l->second; cmTarget& cmtarget = l->second;
// add the soon to be generated Info.plist file as a source for a MACOSX_BUNDLE // add the soon to be generated Info.plist file as a source for a
// file // MACOSX_BUNDLE file
if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")) if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
{ {
cmSourceFile file; cmSourceFile file;
file.SetName("Info", file.SetName("Info",
this->CurrentMakefile->GetCurrentOutputDirectory(), this->CurrentMakefile->GetCurrentOutputDirectory(),
"plist", false); "plist", false);
cmtarget.GetSourceFiles().push_back(this->CurrentMakefile->AddSource(file)); cmtarget.GetSourceFiles().push_back
(this->CurrentMakefile->AddSource(file));
} }
std::vector<cmSourceFile*> & classes = cmtarget.GetSourceFiles(); std::vector<cmSourceFile*> & classes = cmtarget.GetSourceFiles();
@ -1916,20 +1944,22 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::string const& source = sf->GetFullPath(); std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup& sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups); mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, &sourceGroup); cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup);
this->GroupMap[sf] = pbxgroup; this->GroupMap[sf] = pbxgroup;
} }
} }
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(cmTarget& cmtarget, cmXCodeObject* cmGlobalXCodeGenerator
cmSourceGroup* sg) ::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg)
{ {
cmStdString s = cmtarget.GetName(); cmStdString s = cmtarget.GetName();
s += "/"; s += "/";
s += sg->GetName(); s += sg->GetName();
std::map<cmStdString, cmXCodeObject* >::iterator i = this->GroupNameMap.find(s); std::map<cmStdString, cmXCodeObject* >::iterator i =
this->GroupNameMap.find(s);
if(i != this->GroupNameMap.end()) if(i != this->GroupNameMap.end())
{ {
return i->second; return i->second;
@ -1973,10 +2003,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(cmTarget& cmtarget,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root, void cmGlobalXCodeGenerator
std::vector<cmLocalGenerator*>& ::CreateXCodeObjects(cmLocalGenerator* root,
generators std::vector<cmLocalGenerator*>&
) generators)
{ {
this->ClearXCodeObjects(); this->ClearXCodeObjects();
this->RootObject = 0; this->RootObject = 0;
@ -1989,7 +2019,8 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
if(this->XcodeVersion == 15) if(this->XcodeVersion == 15)
{ {
developBuildStyle->AddAttribute("name", this->CreateString("Development")); developBuildStyle->AddAttribute("name",
this->CreateString("Development"));
developBuildStyle->AddAttribute("buildSettings", group); developBuildStyle->AddAttribute("buildSettings", group);
listObjs->AddObject(developBuildStyle); listObjs->AddObject(developBuildStyle);
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
@ -2102,8 +2133,10 @@ void cmGlobalXCodeGenerator::CreateXCodeObjects(cmLocalGenerator* root,
comment += this->CurrentProject; comment += this->CurrentProject;
comment += "\""; comment += "\"";
configlist->SetComment(comment.c_str()); configlist->SetComment(comment.c_str());
configlist->AddAttribute("defaultConfigurationIsVisible", this->CreateString("0")); configlist->AddAttribute("defaultConfigurationIsVisible",
configlist->AddAttribute("defaultConfigurationName", this->CreateString("Debug")); this->CreateString("0"));
configlist->AddAttribute("defaultConfigurationName",
this->CreateString("Debug"));
cmXCodeObject* buildSettings = cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
const char* osxArch = const char* osxArch =
@ -2178,7 +2211,8 @@ void
cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::vector<cmXCodeObject*>& targets) std::vector<cmXCodeObject*>& targets)
{ {
cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile.c_str()); cmGeneratedFileStream
makefileStream(this->CurrentXCodeHackMakefile.c_str());
if(!makefileStream) if(!makefileStream)
{ {
cmSystemTools::Error("Could not create", cmSystemTools::Error("Could not create",
@ -2190,8 +2224,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
// correctly by xcode // correctly by xcode
makefileStream << "# DO NOT EDIT\n"; makefileStream << "# DO NOT EDIT\n";
makefileStream << "# This makefile makes sure all linkable targets are \n"; makefileStream << "# This makefile makes sure all linkable targets are \n";
makefileStream makefileStream << "# up-to-date with anything they link to,avoiding a "
<< "# up-to-date with anything they link to,avoiding a bug in XCode 1.5\n"; "bug in XCode 1.5\n";
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
ct = this->CurrentConfigurationTypes.begin(); ct = this->CurrentConfigurationTypes.begin();
ct != this->CurrentConfigurationTypes.end(); ++ct) ct != this->CurrentConfigurationTypes.end(); ++ct)
@ -2235,8 +2269,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
cmXCodeObject* target = *i; cmXCodeObject* target = *i;
std::map<cmStdString, cmXCodeObject::StringVec> const& deplibs = std::map<cmStdString, cmXCodeObject::StringVec> const& deplibs =
target->GetDependLibraries(); target->GetDependLibraries();
for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci = deplibs.begin(); for(std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator ci
ci != deplibs.end(); ++ci) = deplibs.begin(); ci != deplibs.end(); ++ci)
{ {
for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin();
d != ci->second.end(); ++d) d != ci->second.end(); ++d)
@ -2276,7 +2310,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
{ {
// Create a rule for this target. // Create a rule for this target.
std::string tfull = t->GetFullPath(configName); std::string tfull = t->GetFullPath(configName);
makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) << ":"; makefileStream << this->ConvertToRelativeForMake(tfull.c_str())
<< ":";
// List dependencies if any exist. // List dependencies if any exist.
std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator
@ -2360,7 +2395,8 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
{ {
if ((l->second.GetType() != cmTarget::INSTALL_FILES) if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS) && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
&& (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0) && (strncmp(l->first.c_str(),
"INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
&& banned.find(l->second.GetName()) == banned.end()) && banned.find(l->second.GetName()) == banned.end())
{ {
cmTarget& target = l->second; cmTarget& target = l->second;
@ -2369,7 +2405,8 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
// this target // this target
for(unsigned int k =0; k < cc->GetDepends().size(); k++) for(unsigned int k =0; k < cc->GetDepends().size(); k++)
{ {
if(cmSystemTools::GetFilenameName(cc->GetDepends()[k]) == target.GetFullName()) if(cmSystemTools::GetFilenameName
(cc->GetDepends()[k]) == target.GetFullName())
{ {
sameAsTarget = true; sameAsTarget = true;
} }

View File

@ -138,7 +138,8 @@ private:
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
cmSourceFile* sf, cmSourceFile* sf,
cmTarget& cmtarget); cmTarget& cmtarget);
void CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&); void CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&);
void AddDependTarget(cmXCodeObject* target, void AddDependTarget(cmXCodeObject* target,
cmXCodeObject* dependTarget); cmXCodeObject* dependTarget);
void ConfigureOutputPaths(); void ConfigureOutputPaths();