开发者

Building a solution with multiple projects and multiple configuration

开发者 https://www.devze.com 2023-01-04 16:54 出处:网络
Visual Studio 2010 Premium, Native WIN32 MFC Project (no .net project in solution). We have a complex solution with 35 projects. We have many clients for that product and what we normally do was to c

Visual Studio 2010 Premium, Native WIN32 MFC Project (no .net project in solution).

We have a complex solution with 35 projects. We have many clients for that product and what we normally do was to create a separate configuration for each client. Configuration did not have any major changes except few #define and changes to output directory. It was working fine but now with each change in product requires change in multiple configuration and is also error prone. We want to clean up multiple configurations with just one generic configuration depending on certain parameters and passing those parameters through a batch file for building builds.

to build for a client 'A' conditional compilation #define _BUILD_PROJECT_FOR "A" its output folder i开发者_C百科s in "c:\builds\client\a" out of 35 projects in solution we need only 32 projects for that client

What command and parameters to pass so that I can build a solution at command line by just passing #ifdef, what projects to build and their output directory.

I am trying with msbuild but unable to pass to compiler the preprocessor arguments.


For the preprocessor directives, you can check out this previous question.


More help can be taken from:

http://www.sysnet.pe.kr/Default.aspx?mode=2&sub=0&pageno=0&detail=1&wid=871&title=%25vc%2B%2B%25


This works for me. Using VS2010, I have several projects on the go and all of them needs to #include a few .h files from a common project where I sort of keep them there as shared .h files. If I use something like #define ACTION in the project I am working with, it won't be recognized in any of the shared project files when using #ifdef ACTION while compiling. To resolve that issue, instead of adding #define ACTION in the working project, I add it to the command line option. You get this under Project Properties, C/C++ >> Command Line, enter /D "ACTION" in the Additional Option box. It's the same as saying #define ACTION as far as the compiler is concerned.

Additional notes, I also had to "Add" Add >> Existing Items, of the .h and .cpp shared files I wanted to use from my shared project into my working project to satisfy my complaining linker. I hope this helps.

0

精彩评论

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