views:

45

answers:

1

I've made a tool that operates directly on .obj files before they are linked. I can specify my tool on the pre-link event command line and manually specify each .obj file, but is there any macro or technique that I can use that will automatically include all .obj files from a particular project? There are other .obj files in the same directory from other projects in my solution that I don't want to include, so I can't do a *.obj.

The tool itself is part of the same solution. It is compiled first and then some of the other projects use this tool before they are linked.

A: 

The solution that I have come up with is to use a unique intermediate directory for each project. Then I can use the following pre-link event command line:

cd $(IntDir) && for %%f in (*.obj) do $(OutDir)\myTool.exe -flags %%f

When $(OutDir) is common among all projects in the solution, and the dependency order enforces that myTool.exe is compiled first, then the above works.

dreamlax