Explorar o código

Xcode: Add "outputPaths" to custom command script build phase

This is needed for Xcode 9's "New Build System", whose release notes
mention "that output must be declared as an explicit output by the
script which generates it" in reference to outputs of custom script
build phases.
Harry Mallon %!s(int64=8) %!d(string=hai) anos
pai
achega
0348383b8c
Modificáronse 2 ficheiros con 13 adicións e 0 borrados
  1. 2 0
      Help/release/3.9.rst
  2. 11 0
      Source/cmGlobalXCodeGenerator.cxx

+ 2 - 0
Help/release/3.9.rst

@@ -34,6 +34,8 @@ Generators
   This is an experimental feature and can be activated by setting the
   This is an experimental feature and can be activated by setting the
   :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable to a ``TRUE`` value.
   :variable:`CMAKE_XCODE_GENERATE_SCHEME` variable to a ``TRUE`` value.
 
 
+* The :generator:`Xcode` generator now supports Xcode 9.
+
 Commands
 Commands
 --------
 --------
 
 

+ 11 - 0
Source/cmGlobalXCodeGenerator.cxx

@@ -1517,6 +1517,17 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
   makecmd += " all";
   makecmd += " all";
   buildphase->AddAttribute("shellScript", this->CreateString(makecmd));
   buildphase->AddAttribute("shellScript", this->CreateString(makecmd));
   buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
   buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
+
+  cmXCodeObject* outputFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
+  for (std::vector<cmCustomCommand>::const_iterator i = commands.begin();
+       i != commands.end(); ++i) {
+    std::vector<std::string> const& outputs = i->GetOutputs();
+    for (std::vector<std::string>::const_iterator j = outputs.begin();
+         j != outputs.end(); ++j) {
+      outputFiles->AddObject(this->CreateString(*j));
+    }
+  }
+  buildphase->AddAttribute("outputPaths", outputFiles);
 }
 }
 
 
 void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
 void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(