1

Not sure what the best way to explain what I want is, but here goes...

I have a header file ('generated.h') that is generated from another header file ('interface.h') using some python script.

If I add a custom build step to generated.h, that's a circular dependency. Also, 'generated.h' doesn't even exist in a new workspace, so it gets a bit more confusing there.

Should I instead change interface.h to a custom build tool?

'generated.h' is only for use in testing (generated.h's are mock headers) and there may be several. Therefore I don't really want to add a custom build step to interface.h, since that's used in "real" code. It's not really interface.h's responsibility to generate 'generated.h' (or is it?).

I could add the script as an item next to 'generated.h', but if there are many such generated.h-like-files, I would need to modify the script to accept multiple sets of args, or otherwise find a way to add the generation script several times.

What would you recommend?

JamEnergy
  • 720
  • 8
  • 21
  • A pre-build step to generate generated.h should suffice? Or am I missing something? – rustyx Sep 05 '16 at 08:54
  • @RustyX I'm not sure how to customize input dependencies for the Build Event though... ie, how to tell VS "When should I rebuild generated.h?" Otherwise it regenerates the file whenever VS has to do anything at all to the project, causing more rebuilding. Good suggestion though (for future reference, it's called Pre-Build Event, and you find that in right click->properties on the proj, then look in Build Events). – JamEnergy Sep 05 '16 at 13:30
  • I think the pre-build step is invoked on every build. But you can do the check in the script that it invokes, e.g. compare the last updated time of the input and output files. – rustyx Sep 05 '16 at 13:38

0 Answers0