I would like to add a custom preprocessor for .cpp files in my Visual C++ MSBuild project.
Currently I am using a custom buildstep to find all .cpp files and rewrite them (destroying the original content) before they a being compiled. This is no longer acceptable as the preprocessor should make changes "invisible" to the developer (converting lines with a scripting language to real C++ code).
The preprocessing should be done "On the fly". Dependencies should not be affected at all. The custom preprocessor is able to create #line preprocessor directive so compiler errors can be redirected to the original file.
It seems to me that build events and custom build steps are no viable way to do this so.
I tried to replace to compiler binary with my own which calls the custom preprocessor and feeds the output into the original compiler, but this was more of a "proof of concept" and is surely not a production-ready solution.
Q1: Where do I have to look for what I am trying to achieve?
Q2: and is there a possibility to do this in a solution without changing the Visual C++ installation (The custom preprocessor is also part of the solution and compiled before any of the other projects)