Patching third party sources

We have a project that currently only builds successfully on Windows, but we’re trying to get it working on Mac and Linux as well.

One of the plugins we use croaks, on Mac, in a headerfile in libjpeg-turbo (which is a ThirdParty Source in the Engine), because it ends up trying to redefine DLLEXPORT. I did a quick-fix where I simply changed #else to #elif !defined(DLLEXPORT), which makes the plugin build successfully.

However, I accomplished this by modifying UnrealEngine’s installed files, so if I verify the installation then presumably it’ll yell at me and remove my modification.

If I’ve understood it correctly, for built-in plugins that need modifications one can copy the plugin to the project and it’ll take precedence over the Engine’s version.

Is there any similar mechanism for the Engine’s third party sources? I.e. is there some way I can tell the build system to use libjpeg-turbo in the project instead?