Is it possible to control how .obj files are generated for files in a module?

Hi,

I have a module that allows users to compile and use protobuf files in Unreal engine. Typically, protobuf semantic versioning enforces a directory structure like this:

service/v1/foo.proto
service/v2/foo.proto

This generates c++ output that looks like this

service/v1/foo.pb.cc
service/v2/foo.pb.cc

This seems to be causing collisions in some cases because Unreal generates 2 files named foo.pb.obj, so when it tries to write the second file, it fails.

In other cases, Unreal generates both foo.pb.cc as includes in Module.xxx.cpp

"
#include service/v1/foo.pb.cc
#include service/v2/foo.pb.cc
"

This fails because the protobuf generated files include module initialization code which can only be called once per compilation unit.

What I’m looking for is a way to manually group these object files. I’d like my intermediates to look like

builddir/service/v1/foo.pb.obj
builddir/service/v2/foo.pb.obj

Or

builddir/service_v1_foo.pb.obj
builddir/service_v2_foo.pb.obj

Is there a way to do this via build.cs, project organization, or other means?

It looks like this was an issue specific to something this game was doing, so I’m going to close this.