Просмотр исходного кода

BUG: Fixed generation of XCODE_DEPEND_HELPER.make into proper directory. Cleaned up duplicate code created by recent changes.

Brad King 18 лет назад
Родитель
Сommit
6c421971b9
2 измененных файлов с 20 добавлено и 21 удалено
  1. 19 20
      Source/cmGlobalXCodeGenerator.cxx
  2. 1 1
      Source/cmGlobalXCodeGenerator.h

+ 19 - 20
Source/cmGlobalXCodeGenerator.cxx

@@ -229,14 +229,7 @@ void cmGlobalXCodeGenerator::Generate()
   for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
     { 
     cmLocalGenerator* root = it->second[0];
-    this->CurrentProject = root->GetMakefile()->GetProjectName();
-    this->SetCurrentLocalGenerator(root);
-    this->OutputDir = this->CurrentMakefile->GetHomeOutputDirectory();
-    this->OutputDir = 
-      cmSystemTools::CollapseFullPath(this->OutputDir.c_str());
-    cmSystemTools::SplitPath(this->OutputDir.c_str(),
-                             this->ProjectOutputDirectoryComponents);
-    this->CurrentLocalGenerator = root;
+    this->SetGenerationRoot(root);
     // add ALL_BUILD, INSTALL, etc
     this->AddExtraTargets(root, it->second);
     }
@@ -244,19 +237,29 @@ void cmGlobalXCodeGenerator::Generate()
   for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
     { 
     cmLocalGenerator* root = it->second[0];
-    this->CurrentProject = root->GetMakefile()->GetProjectName();
-    this->SetCurrentLocalGenerator(root);
-    this->OutputDir = this->CurrentMakefile->GetHomeOutputDirectory();
-    this->OutputDir = 
-      cmSystemTools::CollapseFullPath(this->OutputDir.c_str());
-    cmSystemTools::SplitPath(this->OutputDir.c_str(),
-                             this->ProjectOutputDirectoryComponents);
-    this->CurrentLocalGenerator = root;
+    this->SetGenerationRoot(root);
     // now create the project
     this->OutputXCodeProject(root, it->second);
     }
 }
 
+//----------------------------------------------------------------------------
+void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
+{
+  this->CurrentProject = root->GetMakefile()->GetProjectName();
+  this->SetCurrentLocalGenerator(root);
+  std::string outDir = this->CurrentMakefile->GetHomeOutputDirectory();
+  outDir =cmSystemTools::CollapseFullPath(outDir.c_str());
+  cmSystemTools::SplitPath(outDir.c_str(),
+                           this->ProjectOutputDirectoryComponents);
+
+  this->CurrentXCodeHackMakefile =
+    root->GetMakefile()->GetCurrentOutputDirectory();
+  this->CurrentXCodeHackMakefile += "/CMakeScripts";
+  cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str());
+  this->CurrentXCodeHackMakefile += "/XCODE_DEPEND_HELPER.make";
+}
+
 //----------------------------------------------------------------------------
 void 
 cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, 
@@ -273,10 +276,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
   
   // Add XCODE depend helper 
   std::string dir = mf->GetCurrentOutputDirectory();
-  this->CurrentXCodeHackMakefile = dir;
-  this->CurrentXCodeHackMakefile += "/CMakeScripts";
-  cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str());
-  this->CurrentXCodeHackMakefile += "/XCODE_DEPEND_HELPER.make";
   cmCustomCommandLine makecommand;
   makecommand.push_back("make");
   makecommand.push_back("-C");

+ 1 - 1
Source/cmGlobalXCodeGenerator.h

@@ -157,6 +157,7 @@ private:
                        cmXCodeObject* dependTarget);
   void CreateXCodeDependHackTarget(std::vector<cmXCodeObject*>& targets);
   bool SpecialTargetEmitted(std::string const& tname);
+  void SetGenerationRoot(cmLocalGenerator* root);
   void AddExtraTargets(cmLocalGenerator* root, 
                        std::vector<cmLocalGenerator*>& gens);
   cmXCodeObject* CreateBuildPhase(const char* name, 
@@ -186,7 +187,6 @@ private:
   std::string CurrentReRunCMakeMakefile;
   std::string CurrentXCodeHackMakefile;
   std::string CurrentProject;
-  std::string OutputDir; 
   std::set<cmStdString> TargetDoneSet;
   std::vector<std::string> CurrentOutputDirectoryComponents;
   std::vector<std::string> ProjectOutputDirectoryComponents;