开发者

Specifying multiple build rules/tools per input file in a VS2008 project

I have a pre-processor that I'd like to run on my .cpp/.h files before compiling them. I created a Custom Build Rule and applied it to my project. This successfully runs the pre-processor, but it does not actually compile the files afterwards. So what I'd like开发者_运维知识库 to do is run my custom rule first and then run the C/C++ Compiler Tool as default.

I could do this with a pre-build step, but then I'd have to force processing of all source files in the project, when I really just want to process the source files that have changed.

Any help is appreciated!


With advanced builds you are generally better off using an external makefile. You can add this in to MS2008 as a custom tool.

See: Good techniques to use Makefiles in VisualStudio?

If you do not want to use external scripts, you may be able to get what you want by having two projects within your solution with the same files in them. You make one project a dependency of the other. In the dependent project use your custom build rule, in the top project do the real compile/build. Caveat emptor - I've not tried this.

Let us know how you get on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜