How to recompile specific PCH.h file?

Hi all,

I really often have an error like the one below:

fatal error: file ‘/usr/include/linux/sysctl.h’ has been modified since the precompiled header ‘/path/to/UnrealEngine/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/Core/CorePrivatePCH.h.gch’ was built note: please rebuild precompiled header ‘/path/to/UnrealEngine/Engine/Intermediate/Build/Linux/B4D820EA/UnrealLightmass/Development/Core/CorePrivatePCH.h.gch’

In order to solve this error, what I normally do is REMOVE ALL .gch files with:

for f in $(find /path/to/Unreal -name "*.gch"); do rm -v $f ; done 

After this I compile the project again. Although this approach works, the compilation takes ages, because undoubtedly I’m removing .gch files that don’t need to be removed.

What I would like to do is recompiling only those specific PCH.h files independently, so that when compiling my project I won’t have this error.

Is there a way to recompile only specific .h files in Unreal?

Thank you very much for any help.

PS:

Only removing those specific .gch files won’t solve my problem because if I remove one and compile my project again, after 10 minutes compiling clang will probably complain about a different .gch file which needs to be rebuilt.

What I’m planning to do is creating a test_X_.cpp for each PCH.h file ( _X_ is the name of the PCH.h file)

Each test_X_.cpp would be compiled before compiling my project to detect whether a specific PCH.h file needs to be recompiled.
The test_X_.cpp would contain only the header file. Something like:

#include "_X_.h"
int main() { return 0; }