I have prepared some sort of compiler wrapper which:
- Invoke original compiler with original params(+ flags needed to force preprocessing only) to generate preprocessed C++ file
- Do some sort of magic on preprocessed file
- Invoke original compiler with approximately original params to generate object file from my magically changed file
Similar procedure for linking executables, static/shared libraries etc.
My wrapper is designed to handle gcc, clang and msvc flags.
To inject my "compiler wrapper" for cmake projects, make projects or autotools is very easy(cmake params, env variables, autotools params etc.), however I have no idea how to do this with Visual Studio solutions or msbuild.
So question is: do you know any way, how can I force msbuild or visual studio to use my wrapper instead cl?
(mostly interesting for me is msvc 2015 professional, however this probably doesn't matter)
Only idea I have is to change PATH env variable and name my wrapper cl.exe but this smells for my very ugly and I will be very surprised if there is no more clever solution.