How to load different dependency modules for different build targets

I’m targeting different standalone VR headsets and, for example, I need to load the Oculus plugin on the Quest and the WaveVR plugin for Vive standalone headsets. I can selectively load plugins with the different target.cs files. But I also need to load different dependency modules in my build.cs file for different build targets.
I.e. I need to add “PrivateDependencyModuleNames.Add(“OculusHMD”);” to my build.cs but only when targeting the Quest.

I tried the following:

GlobalDefinitions.Add("MY_VAR=0"); in target1.cs
and GlobalDefinitions.Add("MY_VAR=1"); in target2.cs

I need a way to check that in my build.cs file.

Something like this, which doesn’t work.

if (PublicDefinitions.Contains("MY_VAR=1")) {
PrivateDependencyModuleNames.Add("");
}

Anyone have any ideas? Or a different way of handling this?