Xcode 15.3 Command Line Build of Aggregate Doesn't Respect Derived Data Location

I have an aggregate project that compiles several Xcode projects. All Derived Data locations are set to the default:

  • Xcode > Settings > Locations > Advanced = Unique (the default)
  • Aggregate Project > File > Project Settings... > Derived Data = Default Location
  • Individual Sub Projects > File > Project Settings... > Derived Data = Default Location

And yet, when I do a command line build, for each of the sub projects, a "build" folder is created alongside the sub project's xcodeproj file.

Note that this project is quite old, going back many Xcode versions. I had previously had Xcode > Settings > Locations > Advanced set to "Legacy", but am shifting these old projects to use the default DerivedData location – this might be part of the problem, given that the Legacy mode always created a "build" folder next to the .xcodeproj file.

Can anyone explain this?

Best Wishes, Mark

Answered by Mr. Fantatsic in 819653022

I solved the issue by ensuring that only the aggregate target was compiled using the -configuration option – though there is still a problem with how Xcode behaves if one does not include this parameter.

I changed my build command from this:

xcodebuild -configuration Release -project AggregateProject.xcodeproj

to this:

xcodebuild -configuration Release -scheme "Build All Projects" -project AggregateProject.xcodeproj

After compiling this way, all of the Products ended up in the default Derived Data location ( ~/Library/Developer/Xcode/DerivedData/AggregateProject-blahblah/Build/Products/Release) as expected, and no "build" folders were created next to the subproject's .xcodeproj files.

Still, I don't understand why the build location settings of the subprojects, and Xcode's global setting, are not respected when you compile without the -configuration option. Maybe somebody has an idea.

Best Wishes, Mark

Accepted Answer

I solved the issue by ensuring that only the aggregate target was compiled using the -configuration option – though there is still a problem with how Xcode behaves if one does not include this parameter.

I changed my build command from this:

xcodebuild -configuration Release -project AggregateProject.xcodeproj

to this:

xcodebuild -configuration Release -scheme "Build All Projects" -project AggregateProject.xcodeproj

After compiling this way, all of the Products ended up in the default Derived Data location ( ~/Library/Developer/Xcode/DerivedData/AggregateProject-blahblah/Build/Products/Release) as expected, and no "build" folders were created next to the subproject's .xcodeproj files.

Still, I don't understand why the build location settings of the subprojects, and Xcode's global setting, are not respected when you compile without the -configuration option. Maybe somebody has an idea.

Best Wishes, Mark

Xcode 15.3 Command Line Build of Aggregate Doesn't Respect Derived Data Location
 
 
Q