XCode 10 default build system fails with add_custom_command
XCode 9 introduced a new build system (optionlly). It has tighter requirements around scripts with input and output files, so it won't build current CMake projects (which do not fill those fields in).
I submitted a patch (!1054 (merged)), which caused a regression and was reverted (!1183 (merged)) a while ago to try to support this. XCode 10 has the new build system on by default.
I think all will work if we fill in the 'inputPaths' and 'outputPaths' variables correctly.
Considering multiple add_custom_commands can be squashed together into one Xcode node I think we need to do something like below (warning: this psuedocode, if translated directly to c++, could be quite slow...)
array inputPaths
array outputPaths
for command in commands
{
inputPaths += command->Inputs
outputPaths += command->Outputs
outputPaths += command->Byproducts // Is this needed?
}
removeDuplicates(inputPaths)
removeDuplicates(outputPaths)
for inputPath in inputPaths
{
if inputPath not in outputPaths
{
xcodeproj->addInput(inputPath)
}
}
for outputPaths in outputPaths
{
if outputPath not in inputPaths
{
xcodeproj->addOutput(outputPath)
}
}