How can I compile sources of third party?

I’m trying to use a library that open source project. but I don’t know how to compile them for game module. There are some explain about static lib but sources(.h/.cpp).

Wiki Doc about Static Lib

In VC++, I can add directory of source at project property dialog but UE doesn’t work at all.

In addition, copied all of source files to Project/Source, and included a header of that to (ProjectName).h. Then compiled it, UBT occured an error.

error : The first include statement in source file ‘(ThirdParty).cpp’ is trying to include the file ‘(ThirdParty).h’ as the precompiled header for module ‘(ProjectName)’, but that file could not be located in any of the module’s include search paths.

How can I fix this? Thanks.

You can take a look at Engine/Source/ThirdParty directory and model your third-party on an existing one (e.g. using zlib as an example).

Note that normally we don’t compile third party libraries as part of the solution, just link to them. If you change it frequently, you may want to make it a normal module, see Engine/Source/Runtime for an example.

In both cases, check that third party’s license is compatible with Unreal’s EULA.