GCC pre-compiled header found in different folder (Idea)
I got gcc pre-compiled headers to work with a regular makefile and tried your code and played with it. The whole forced include is necessary, if one uses #include "header.h. If one uses #include <header.h> instead, the pre-compiled header file can reside in the build folder, if that directory is included as the first one. Even though the documentation says that header.h and header.h.gch must be in the same directory - this is actually not true. I let cmake create a <target>_inc directory, where I let Ninja put the pre-compiled header. The FORCEINCLUDE is no longer necessary.
GCC pre-compiled header found in different folder (Idea)
I got gcc pre-compiled headers to work with a regular makefile and tried your code and played with it. The whole forced include is necessary, if one uses
#include "header.h
. If one uses#include <header.h>
instead, the pre-compiled header file can reside in the build folder, if that directory is included as the first one. Even though the documentation says thatheader.h
andheader.h.gch
must be in the same directory - this is actually not true. I let cmake create a<target>_inc
directory, where I let Ninja put the pre-compiled header. The FORCEINCLUDE is no longer necessary.