In my Premake file I go:
pchheader("../../"..dir_root.."stdafx.h")
I found that this at least partially works. (The invocation is somewhat different for ICC on Windows.)
When compiling, I get exactly one warning:
stdafx.h
../../mylibrary/stdafx.h:1:9: warning: #pragma once in main file
#pragma once
^
I believe this comes from GCC compiling the precompiled header (as if it were some kind of main file). So, this warning is (kindof?) justified.
I would rather not remove the #pragma once
which is obviously in stdafx.h
(although I imagine that would fix the warning), because of builds not using the PCH.
Is that my only option, or is there something else I can do? I am tagging this both gcc and premake, since a solution using either (e.g. change the compile arguments, call differently into Premake) would be fine.