I do not think that there is something, although I, of course, understand the desire for this. Whenever I have to build my cross-platform library on a system that does not support PCH, it takes forever, since a lot of files pull in the path more than they really need, and it would be nice to trim it. Unfortunately, I cannot because of how Visual Studio handles PCH. Namely, the inclusion of PCH should be the first non-commentary file. From the way you formulated your question, I suspect that you are also working with Visual Studio.
I'm not sure if this will work for you, but you can try something like this:
#include MY_PCH_FILE
And use / DMY _PCH_FILE = "myfile.h"
on the command line to control what the first include file is. After that, you have full control over what is included in the kit, and the right header protectors, along with optimizations in most modern compilers to detect header protection, can reduce build time. You can change the macro definition for an individual file in the build settings of your project, in a similar estate, as you can change the PCH settings for each file.
Although I must admit that I'm not sure what you are trying to do, and I suspect that this is really an XY problem
source share