Răsfoiți Sursa

Keep Xcode intermediate files away from output dir

Previously the Xcode generator set SYMROOT to be the target output
directory.  This told Xcode to put the "<proj>.build" directory in the
output path too.

This commit sets SYMROOT, CONFIGURATION_BUILD_DIR, and OBJROOT to put
intermediate files in the build directory corresponding to the source
directory that created each target.  This is more consistent with the VS
IDE generators.  Now only the build output files (actual targets) go to
the target output directory.
Brad King 16 ani în urmă
părinte
comite
95038439ea
1 a modificat fișierele cu 14 adăugiri și 2 ștergeri
  1. 14 2
      Source/cmGlobalXCodeGenerator.cxx

+ 14 - 2
Source/cmGlobalXCodeGenerator.cxx

@@ -1564,7 +1564,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
      target.GetType() == cmTarget::MODULE_LIBRARY ||
      target.GetType() == cmTarget::EXECUTABLE)
     {
-    pndir = target.GetDirectory();
+    if(this->XcodeVersion >= 21)
+      {
+      std::string pncdir = target.GetDirectory(configName);
+      buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
+                                  this->CreateString(pncdir.c_str()));
+      }
+    else
+      {
+      buildSettings->AddAttribute("OBJROOT",
+                                  this->CreateString(pndir.c_str()));
+      pndir = target.GetDirectory(configName);
+      }
     buildSettings->AddAttribute("EXECUTABLE_PREFIX", 
                                 this->CreateString(pnprefix.c_str()));
     buildSettings->AddAttribute("EXECUTABLE_SUFFIX", 
@@ -2910,7 +2921,8 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         // then remove those exectuables as well
         if(this->Architectures.size() > 1)
           {
-          std::string universal = t->GetDirectory();
+          std::string universal =
+            t->GetMakefile()->GetCurrentOutputDirectory();
           universal += "/";
           universal += this->CurrentProject;
           universal += ".build/";