In my C++ project I have a (large) number of .foo files that get transformed into .bar files using a custom build step that runs foo2bar on the .foo file.
The resultant .bar output file is not further used in any build steps. It is however used when running the c++ project(s) executable output.
The problem here is that the .foo files handle their own internal nested #include-like handling of dependant files. And this messes up the custom build step. It's not just .foo => .bar It's .foo + (a ton of includes derived from the .foo contents) => .bar
I basically want the custom build step to ALWAYS run the build command, and let the foo2bar compiler figure out if the output .bar is up to date or not. How to do that ?
tried:
- the "simple" solution seems to be to list ALL the include dependencies in the custom build step. This is pretty much a no-go, managing and maintaining this manually is not feasible.
- setting the output to neverExists.bleh This works, it always triggers a build. But then you get an error at the end that the output was never created. 2b) you can solve that by setting the Custom Build Step flag 'Verify Dependencies and outputs exist' to NO... But when building the solution on Azure build agents, it can't detect build errors and the builds are erroneously passing when they shouldn't. The return value of foo2bar.exe (i.e. errorlevel) is ignored (local build seems to handle this ok). Any error messages are ignored (local build catches these from the console output).
How do you make a vc++ project run a "custom compiler that has its own include dependency handling" on project source files ? It doesn't have to be a custom build step per se.
**\*.foo
?protoc
, Google protobuf compiler.protoc
has--dependency_out
option that dumps a transitive list of imports to a file. So we have a CMake script that runsprotoc
in that mode on every source.proto
file, extracts the list of dependencies, and adds them as additional inputs for that.proto