Can't add ThirdParty source files to project

When I add my ThirdParty sources inside the Source folder, I get the famous PCH message asking me to put the same include line in every source file. For most libs, this is not possible, because they are used with other projects.

When I put the files outside, on the same level as the Source folder, and add the sources to my XCode project, the build system will remove my link as soon as I use the services command “Generate XCode project”, which is needed since the new project structure has been introduced.

Is there a solution to compile 3rd party sources without the need of the standard UE4 PCH?

Building on OSX is a PITA, not talking about the weird behaviour of the error display, the optinization mode and the reset to the UE4 scheme after each generation.
Nevertheless - thank you for this great engine, but XCode needs more love. :wink:

@anonymous_user_536ed8c4 also:

I’m not sure if there is a way to compile without the PCH, I don’t think there is as long as you’re wanting your source be built by the Unreal Build Tool. I will say that adding files to the Xcode project works exactly the same as a Visual Studio project in that what you add to it does it matter. That project only exists for XCode itself, the Unreal Build Tool doesn’t use that information, and instead only looks at the Build.cs files and the directory structure itself.

As far as I know the only way to compile 3rd party source without being forced to use the PCH is by adding it as a 3rd party plugin. In the editor if you got to Edit → Plugins and add a New Plugin and look for “Third Party Library” for an example.

Hello,

Has Koderz’s answer been of any help to you? If not, please let me know and I’ll look into this issue for you.

Koderz, thank you for the info.
I had a look into the “Third Party Library” library plugin, but this is Windows only and for dynamic libraries.
What I need to do is adding static libraries to my plugins or as a 2nd choice at least add unmodified sources files.
@
Would be great to have an option in the Unreal Build Tool, that can use a set of files without Unreal PCH.
At least, when I add files OUTSIDE the source folder, the “Generate XCode project” should NOT REMOVE these files from XCode.
As Koderz wrote, the build tool doesn’t need XCode, so leave my files alone. :wink:
Thank you for looking into this issue.

I began looking into options to do that and came across this post from a while back. I’m not 100% sure if the information is relevant since it is back from 4.6 but please take a look and see if this method may help you.

There is now a solution for static libs in my @see also link mentioned above.
For reference: Put the following block into your public MyPlugin(TargetInfo Target) section.

 PublicAdditionalLibraries.AddRange(
        new string[]
        {
              "/path_to_your_library/libHelloWorld.a"
        }
        );

The PublicAdditionalLibraries is not included in the plugin templates, I recommend to add it - Unreal can you hear me? Thanks everybody for helping me.
@see also: How to include sources without PCH include - Platform & Builds - Unreal Engine Forums .