views:

328

answers:

3

I started adding support for a 3rd party toolchain (IAR Compiler) to Visual Studio 2005.

So far I've managed to implement the required msbuild tasks (Compile, Link and Assemble) and the Visual Studio Add-in to support the *.proj file.

The next hurdle is handling dependencies for the headers. I'm not sure what the best way to go about this is.

The IAR compiler provides a command line switch to get the list of header files a source depends on, but how should I provide this information to Visual Studio/MSBuild?

A: 

Add all the headers your source files uses in a given project into the 'header files' pseudo folder that you see when you expand the project node. That defines the dependency of source on headers.

hackworks
The question is, to tell Visual Studio which headers belong there from an external (automated) tool. You're describing a manual way.
MSalters
A: 

It really is up to the compiler to do the header file dependency check. It's impractical to specify includes in your msbuild file. Plus some files can be included based on #defines and so on.

Filip
Yes I plan to use the compiler. But I want MSBuild to use the dependency list generated by the compiler. What I'm not sure of is how to achieve this. I don't want to compile my sources needlessly.
Dushara
A: 

You would have to make the compilation target you created depend on another target, which generated the input and output files and put them in item lists. Then reference those item lists on the inputs and output attributes of your compilation target.

Is that what you're looking for?

dan/MSBuild

dan