I have a perl script in my VS2010 build that autocodes a header file using several header files as input.
In other words, script.pl reads a.h, b.h, c.h, and generates z.h
How can I set up a dependency such that this script is re-run anytime one of the input header files changes?
I don’t know about automatically re-running it based on a dependency / filesystem check, but surely you can just add a custom pre-build step to the project or solution to just call the perl script directly. In VS2010, go to the Project menu, select ‘ Properties…’, then go to the Build Events tab. In the pre-build event command line box, type the command line to call script.pl.
Check out the MSDN docs for some helpful macros and shortcuts for build paths. Also, that page does say
So it probably won’t run script.pl if there have been no changes to any files in the project, but changes to
a.h,b.h, orc.hshould be enough to make surez.hgets generated. Unless you don’t have the upstream header files added to the project… which could be another can of worms.If that’s the case, the workaround that springs to mind is to create a second dummy project called ‘HeaderBuild’ or some such who’s only job is to include the required
.hfiles, callscript.pland copy thez.houtput to your real projects header dir. Make sure the dummy project runs before the real one and you should be good to go.