You are correct; this is for compiled external symbols; ie. .a or .lib static library file you have compiled already, with say, cmake.
The PublicDependencyModuleNames
is a list of modules that the engine must find and compile itself.
The key difference here is that if you have a 3rd party library that you do not possess the source for, for example, the leap motion, you cannot link it as a dependent module.
However, as you can see from the example, you are forced to manually compile these external symbols for the build target, rather than relying on the UBT to correctly provide the link flags, etc. for the various platforms.
So, all in all, unless you have no alternative, writing a ‘Plugin’ for a 3rd party library, that uses the UBT to compile the library is categorically superior to linking statically to an externally built library… but sometimes its unavoidable.
Also, you would, of course, assume that linking a dynamic library would work right?
Haha! No.
See, what happens is a plugin is compiled as a dynamic library; and if it links to a dynamic library, your dependency chain looks like this:
MyProject <>---- MyPlugin <>---- libvpx
Guess which symbols from libvpx are usable from MyProject? Only the symbols that are actually used from MyPlugin. Seems obvious, and no problem? Practically speaking, it’s a real pain.
You have to manually export the library symbols in your plugin, or write a wrapper for them explicitly. This means you cannot do this:
MyProject <>---- My3rdPartyDeps <>— libfoo, libvpx, libcereal, …
And then directly use those libraries from your project.
Statically linking overcomes this problem; but indeed, you can use dynamic linking for the same effect, if you want to. …but I warn you now, I strongly recommend against it. I’ve directly seen 3 different gamejam groups go down this road and crash and burn directly because of it. /shrug